-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Captions with streaming libraries #994
Comments
Amazing work! For some reason on my end I can see the different caption options for HLS but they are not showing themselves on the player. Dash is working perfectly though! |
Yeah. Have seen that in HLS too occasionally. Like the German track in the demo ^. Not sure what's happening there. |
Updated the hls.js demo to use the hls.js canary version (https://cdn.jsdelivr.net/npm/hls.js@canary) since that seems to fix all the issues I had in the demo (the German captions not working and some captions not showing the first time). |
Is there any way we can we get to work in the general case? I'd like to dynamically add textTracks to HTML5 videos. How can I achieve this? Here's an example |
This should work: new Plyr(video, {captions: {update: true}});
const track = video.addTextTrack('subtitles', 'Volapük', 'vo');
track.addCue(new VTTCue(0, 3, 'Your first cue')); Not sure why you're doing it via the dom. It should work too, but you'll need more code to achieve this. I haven't tried for this issue, but I'm pretty sure I have done this before and it created the |
I was checking if my code works for the native HMTL5 player (it does) and was hence doing it via the DOM. Why is it that I'm able to add a TextTrack and have it work via the native player but not through Plyr? In my usecase, ideally, I'd like to set it up to use |
I see. If you have URLs rather than creating them as blobs I can see the benefit to using the dom. Either way. make sure you actually get this working without Ply first, and that |
It does work without Plyr: Here's the same example with the native player. |
Neither the video nor the caption loads. You have probably installed a browser plugin like "Allow-Control-Allow-Origin: *" or "Cors toggle" to override cors. Also, you need to enable the textTrack: document.querySelector('#video').textTracks[0].mode = 'showing'; // use 'hidden' instead of 'showing' for Plyr Not sure how to do that with the dom, but probably the |
right, sorry, I do have that enabled. I will try and host a video and allow
CORS to get this working
…On Thu, Jun 7, 2018 at 3:14 PM, friday ***@***.***> wrote:
Neither the video nor the caption loads. You have probably installed a
browser plugin like "Allow-Control-Allow-Origin: *" or "Cors toggle"
install to override cors.
Also, you need to enable the textTrack:
document.querySelector('#video').textTracks[0].mode = 'showing'; // use 'hidden' instead of 'showing' for Plyr
Not sure how to do that with the dom, but probably the default property.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#994 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACzB11c9LryMU2Fvrk58eK5IQ4xMRdu7ks5t6XuFgaJpZM4UVu22>
.
|
I forked your pen, changed the sources, set default to true, and used |
Perfect! Thanks for taking the time out to resolve this.
…On Thu, Jun 7, 2018 at 3:54 PM, friday ***@***.***> wrote:
I forked your pen, changed the sources, set default to true, and used
srcLang (not language). It works: https://codepen.io/
fullkornslimpa/pen/ZRBYrR?editors=1011
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#994 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACzB1y8lyyzA7K8ExA78qooJN3a4Etgtks5t6YTkgaJpZM4UVu22>
.
|
Plyr 3.3.12 was just released, with support for In addition to this, I noticed dash.js didn't need to handle the The Plyr documentation has been updated with the same codepen links as in here. We could still use some kind of compatibility table in the wiki or main docs I think. Different providers or libraries support for captions, handling quality and other features. |
I'm collecting all the info I have in one issue (and intend to keep it updated until we can support multiple tracks of the same language and the streaming demos in the main documentation have been updated with captions).
Plyr 3.3.10 added a property
captions.update
for cases when you want Plyr to update the language selection if tracks are added after the instance is initialized.Adding a track dynamically:
Or via the dom:
captions.update
isfalse
by default, since the tracks created with it enabled will likely not have any cues, and hence selecting it won't "work". You can however make it work by listening to thelanguagechange
event and handling the necessary update there.Dash.js
Status: Seems to works perfectly (demo), and we don't even have to handle the
languagechange
event. 🍾 🍰Hls.js
Status: Experimental (demo with multi-track VTT, demo with single-track embedded captions). It's mostly working since v0.10, but seems to require a timeout-hack (which is unsafe). Preloading all tracks would probably solve this, but they don't yet support this. 0.10 also has some other issues that has yet to be fixed.
Shaka Player
Shaka Player only creates one TextTrack withouts any other useful information at all. So it's not possibly to use it with Plyr currently, at least if you want to be able to switch languages. You can however add your own html5
<track>
-elements if your captions are in the VTT format. You also should keepcaptions.update
disabled (default) since otherwise it will just create the option "Shaka Player TextTrack".Tasklist:
languagechange
event). See Captions API limitations #1017 and PR Captions rewrite (use index internally to support missing or duplicate languages) #1015).The text was updated successfully, but these errors were encountered: