DEVHIDE
  • Home (current)
  • About
  • Contact
  • Cookie
  • Home (current)
  • About
  • Contact
  • Cookie
  • Disclaimer
  • Privacy
  • TOS
Login Or Sign up

video.js "hides" subtitle for firefox? How to show it with a generalized way?

1.1k Views Asked by user534498 At 23 June 2015 at 00:51 2025-12-07T11:15:12.101000

I have the following html code:

<div id="video-container" class="container">
<video id="video-player" class="video-js vjs-default-skin" controls
 preload="auto" autoplay width="960" height="540"  crossorigin="anonymous">
  <source src="http://{{$video_server_address}}/file/{{$video_name}}" type='video/mp4' />
  <track label="English" kind="subtitle" srclang="en" src="http://{{$video_server_address}}/file/{{$vtt_name}}" default>
  <p class="vjs-no-js">This video format is not supported.</p>
</video>
</div>

This HTML, without any video.js stuff, will display both videos and subtitles in latest version of FF, chrome and IE without problem.

I then introduce video.js in by the following simple javascript code.

<link href="/js/video-js/video-js.css" rel="stylesheet">
<script src="/js/video-js/video.js"></script>
<script src="/js/jquery-1.11.2.min.js"></script>
<script>
$( document ).ready(function() {
  var player = videojs("video-player");
});
</script>

Then the subtitle is gone for FF. I inspect the video.js created HTML for both FF and chrome, they are different.

For chrome,

<div id="video-container" class="container">
<div crossorigin="anonymous" autoplay="true" preload="auto" class="video-js vjs-default-skin vjs-controls-enabled vjs-has-started vjs-user-inactive vjs-paused vjs-ended" id="video-player" style="width: 960px; height: 540px;">
<video id="video-player_html5_api" class="vjs-tech" preload="auto" autoplay="" crossorigin="anonymous" src="http://127.0.0.1:20001/file/2015/06/23/074043.mp4">
  <source src="http://127.0.0.1:20001/file/2015/06/23/074043.mp4" type="video/mp4">
  <track label="English" kind="subtitle" srclang="en" src="http://127.0.0.1:20001/file/2015/06/23/074043.vtt" default=""></track>
  <p class="vjs-no-js">This video format is not supported.</p>
</video>
==========================================================
===============Ignore many irrelevant stuff here =========
==========================================================
      <div class="vjs-subtitles-button vjs-menu-button vjs-control " role="button" aria-live="polite" tabindex="0" aria-haspopup="true" aria-label="Subtitles Menu">
    <div class="vjs-control-content"><span class="vjs-control-text">Subtitles</span>
      <div class="vjs-menu">
        <ul class="vjs-menu-content">
          <li class="vjs-menu-item" role="button" aria-live="polite" tabindex="0" aria-selected="false">subtitles off</li>
          <li class="vjs-menu-item vjs-selected" role="button" aria-live="polite" tabindex="0" aria-selected="true">English</li>
        </ul>
      </div>
    </div>
  </div> 
</div></div>

And for FF,

<video id="video-player_html5_api" class="vjs-tech" preload="auto" autoplay="" crossorigin="anonymous">
  <source src="http://127.0.0.1:20001/file/2015/06/23/074043.mp4" type="video/mp4">
  <p class="vjs-no-js">This video format is not supported.</p>
</video>
<div aria-label="Subtitles Menu" aria-haspopup="true" tabindex="0" aria-live="polite" role="button" class="vjs-subtitles-button vjs-menu-button vjs-control ">
  <div class="vjs-control-content"><span class="vjs-control-text">Subtitles</span>
    <div class="vjs-menu">
      <ul class="vjs-menu-content">
        <li aria-selected="true" tabindex="0" aria-live="polite" role="button" class="vjs-menu-item vjs-selected">subtitles off</li>
        <li aria-selected="false" tabindex="0" aria-live="polite" role="button" class="vjs-menu-item">English</li>
      </ul>
    </div>
  </div>
</div>

There are two major differences for subtitles, for FF, video.js removed default TRACK tag, this is understandable, because for my testing, FF will not display track subtitle for any dynamically generated video element, so Video.js will try to deal with this by itself? It is ok to me.

The second difference, is for subtitle, you can search for "aria-selected" or "vjs-selected", it is very clear that, for Chrome, the default selection is "English", and for FF, the default selection is "Subtitle Off".

If I manually select English in FF, the subtitle does show.

The problem is then, how can I enable video.js to automatically display the subtitle for FF? I tried to search for video.js API but didn't find any. I used the latest video.js which is 5.0 I think.

javascript html video video.js
Original Q&A
0

There are 0 best solutions below

Related Questions in JAVASCRIPT

  • Angular Show All When No Filter Is Supplied
  • Why does a function show up as not defined
  • I count the time the user takes to solve my quiz using Javascript but I want the same time displayed on another page
  • Set "More" "Less" font size
  • Using pagination on a table in AngularJS
  • How to sort these using Javascript or Jquery Most effectively
  • how to fill out the table with next values in array with one button
  • State with different subviews
  • Ajax jQuery firing multiple time display event for the same result
  • Getting and passing MVC Model data to AngularJS controller
  • Disable variable in eval
  • javascript nested loops waiting for user input
  • .hover() seems to overwrite .click()
  • How to sort a multi-dimensional array by the second array in descending order?
  • How do I find the fonts that are not loading in a CORS situation ( MoovWeb )?

Related Questions in HTML

  • Delay in loading Html Page(WebView) from assets folder in real android device
  • Why does a function show up as not defined
  • CSS Class is not applying to element (border width,color,and style attributes)
  • How to sort these using Javascript or Jquery Most effectively
  • how to fill out the table with next values in array with one button
  • Automatically closing tags in form input?
  • Positioning child at bottom of parent with scroll
  • Remove added set of rows
  • Website zoomed out on Android default browser
  • Twitter Bootstrap horizontal form elements on a line
  • http://sigmajs.org/ les mis tutorial - why are my canvases 0 height?
  • My navbar is not expanding after collapse
  • when a checkbox is checked how to display a different hidden element using javascript
  • Gaps Vertically Using Dividers
  • Svg containers not positioning properly

Related Questions in VIDEO

  • How to open and read video stream in Matlab
  • Extract bytes of specific stream from mpegts file using ffmpeg
  • AVQueuePlayer crashes when I try to observe the start of the next video: AVPlayerItem was deallocated with observers
  • How to get the time stamp of each frame of a GoPro video in MATLAB?
  • DFP Videos Ads Internal error
  • Get youtube video information using javascript and Youtube-API
  • YouTube views not counting on Wordpress embed
  • Videos not working on phones using HTML
  • How to track multiple youtube videos in google analytics
  • Cloudfront stream only part of the video
  • Changing switch statement to include both mp4 and ogg files
  • How to detect squares in video with OpenCV?
  • Saving iOS video buffer
  • dynamic video source change issue in azure media player
  • Video Editing For Android

Related Questions in VIDEO.JS

  • video.js is not loading/working in IE 9,10 or 11
  • How to Install/Use Video.js-HD-Toggle-Plugin-master for Wordpress
  • Why is mp4 audio behaving weirdly in Firefox + videojs player?
  • Video JS v 4.12.7 - IE7, IE8 Issue
  • How to write error message object of videoJS on server
  • Write plugin for VideoJS 5
  • Setting a loop range with video.js
  • How do you get the list of existing markers on the videojs-markers plugin?
  • Video.js Chapter doesn't work
  • video.js "hides" subtitle for firefox? How to show it with a generalized way?
  • Videojs custom error message when error code is 401
  • Update button class with video.js markerReached function
  • Extending progress control in video.js, duplicate progress bars
  • video js giving error CODE:150 undefined
  • Coloring the flash background in update 5.0.0 don't work

Trending Questions

  • UIImageView Frame Doesn't Reflect Constraints
  • Is it possible to use adb commands to click on a view by finding its ID?
  • How to create a new web character symbol recognizable by html/javascript?
  • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
  • Heap Gives Page Fault
  • Connect ffmpeg to Visual Studio 2008
  • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
  • How to avoid default initialization of objects in std::vector?
  • second argument of the command line arguments in a format other than char** argv or char* argv[]
  • How to improve efficiency of algorithm which generates next lexicographic permutation?
  • Navigating to the another actvity app getting crash in android
  • How to read the particular message format in android and store in sqlite database?
  • Resetting inventory status after order is cancelled
  • Efficiently compute powers of X in SSE/AVX
  • Insert into an external database using ajax and php : POST 500 (Internal Server Error)

Popular # Hahtags

javascript python java c# php android html jquery c++ css ios sql mysql r reactjs

Popular Questions

  • How do I undo the most recent local commits in Git?
  • How can I remove a specific item from an array in JavaScript?
  • How do I delete a Git branch locally and remotely?
  • Find all files containing a specific text (string) on Linux?
  • How do I revert a Git repository to a previous commit?
  • How do I create an HTML button that acts like a link?
  • How do I check out a remote Git branch?
  • How do I force "git pull" to overwrite local files?
  • How do I list all files of a directory?
  • How to check whether a string contains a substring in JavaScript?
  • How do I redirect to another webpage?
  • How can I iterate over rows in a Pandas DataFrame?
  • How do I convert a String to an int in Java?
  • Does Python have a string 'contains' substring method?
  • How do I check if a string contains a specific word?

Copyright © 2021 Jogjafile Inc.

  • Disclaimer
  • Privacy
  • TOS
  • Homegardensmart
  • Math
  • Aftereffectstemplates