The Chromecast developer docs say both WebVTT and TTML are Supported Media Types:
https://developers.google.com/cast/supported_media_types
I see captions when using a WebVTT file in a "track" tag within a video element:
<video id="vid" src="http://myurl">
<track kind="captions" src="http://10.16.236.23/test.vtt" srclang="en" label="English" default>
</video>
But when I try to do the same using a valid TTML file, I don't see captions:
<video id="vid" src="http://myurl">
<track kind="captions" src="test.ttml" srclang="en" label="English" default>
</video>
When I inspect the video element in the debugger console, for the WebVTT example I can see
document.getElementById('vid').textTracks[0].cues.length;
16
but for TTML:
document.getElementById('vid').textTracks[0].cues.length;
0
I am on the right track with this or is TTML supported in a different way? Maybe my TTML syntax is not supported by Chromecast?
Unlike webVTT, TTML is not natively supported. If you need to support that in your app, you can simply write a Javascript parser to parse the file and add the cues to your video element in javascript using methods such as addTextTrack(), etc.
According to the Cast Player API, Chromecast now supports WebVTT, TTML1, and CEA-608 (Line 21 Captions) caption formats. Just pass in the CaptionsType enum for your caption format into the player's enableCaptions() method.
Related
We have used hlsJs library (ref: https://github.com/video-dev/hls.js) in Chrome browser to play HLS files.
There we have an event called Hls.Events.FRAG_LOADED which provides information about the hls fragment loaded like sequence number, start and end PTS and any custom tag attached to the fragment (ref: https://github.com/video-dev/hls.js/blob/master/docs/API.md#FRAG_LOADED)
Is there an equivalent event or api which we can listen to in ExoPlayerv2 for Android which can provide me same information about the media segment loaded?
Why I need this?
In my streaming server I am putting some custom EXT tag for each media fragment & i want to read that data when a media fragment is loaded in my player.
This is what I get from hlsJs on chrome browser for FRAG_LOADED event.
Need similar data from exoplayer
Any pointer will be helpful.
Thanks in advance.
You could try looking into the AdaptiveMediaSourceEventListener onLoadComplete method and use the DataSpec object to get both URL and Format objects which can be used to extract some data like bitrate and position of the segments. I do not know if there is an equivalent API out there for what you are looking for.
I have a problem of playing the html5 video(MP4 format) using video tag on linux. Could you please suggest What may be the problem or any alternative solution to make my video play on al l browsers along with all Operationg Systems.
Thanks in advance.
HTML5 doesn’t guarantee any particular video format will be supported by a browser; the solution is to use multiple sources:
A video, using the user agent default set of controls, with alternative sources:
<video controls>
<source src="http://media.w3.org/2010/05/sintel/trailer.mp4"
type='video/mp4; codecs="avc1, mp4a"'>
<source src="http://media.w3.org/2010/05/sintel/trailer.ogv"
type='video/ogg; codecs="theora, vorbis"'>
<p>Your user agent does not support the HTML5 Video element.</p>
</video>
I have been asked to use aif audio files on a website. I am using jplayer.
Would there be a noticeable difference using .aif?
Which browsers support .aif?
Would you advise using .aif for the web?
Would it mean I would need 3 versions of each track to cover all Browsers/OS?
Like so:
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
<source src="horse.aif" type="audio/aif">
Your browser does not support the audio element.
</audio>
Thanks :)
The most widely supported format currently is mp3, aiff is supported but you'd need to test target browsers to determine which offer support.
You might also consider SoundJS, a library I helped develop that lets you play audio across a broad range of browsers and devices using a single code base.
Hope that helps.
Check your own browser.
I could not find a comprehensive list like you have asked for. So this is the second best.
I want to play a video file from my web app. I use JSF. I want to know how we can open the video file with the help of any video player installed in the client's system. I know how to open a pdf file the same way. But I want to know how to open a video file.
There's no standard JSF component for this. It's however not different from as you would do in plain HTML. Just drop the video file in public webcontent (so that it's reachable by an URL) and use the HTML <embed> and/or the <object> element which points to the URL of the video file. That's basically all. Note that you can just use EL in template text. So e.g. <embed src="#{bean.videoURL}"> would work perfectly fine, as long as it generates the HTML code the way you intend (open page in browser, rightclick and View Source to see it).
The way how to create and parameterize the HTML <embed> or <object> tag in turn depends on the video format (MPEG, MOV, FLV, etc). You basically need to consult the documentation of the video format vendor for details how to use it. Since you didn't mention what format the video file is in, we can't help you further in detail. Googling the smart way should however yield sufficient examples. E.g. "embed mpeg in html".
PrimeFaces has however a <p:media> component which makes it all easier for developers who are lazy in Googling for examples and/or figuring the browser specific inconsitenties ;) It'll outright generate the right HTML code necessary for the provided video format.
See also:
How to stream audio/video files such as MP3, MP4, AVI, etc using a Servlet
This works in browsers those support HTML5.
<video controls="controls">
<source src="resources/myVideo.mp4" type="video/mp4"/>
</video>
The major browsers have support for the <object/> tag.
I want to incorporate a video player on my site to play .mkv video, but I cannot use most because the are based on flash, which can only play .flv & .f4v.
That's why I'm switching to the <object/> tag
But, if I wanted to incorporate a tag with the name of <mkvvideo/>, would a simple plugin associated with that tag be usable, or does the core programming of the browser handle that?
Thanks
You can't associate plugins with tags.
Instead you register the mimetypes (and file extensions) that your plugin supports and use that mimetype with the object tag (in this case video/x-matroska).