-
Notifications
You must be signed in to change notification settings - Fork 19
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
Subtitle (Track - VTT) #44
Comments
Support for playing subtitles on Chromecast is a feature that I would like, as well. I spent some time yesterday exploring this issue, and will share my findings. Ideally, I'd like this to trigger some discussion because there are a few moving parts and proper support for this feature would require touching both For my next step, I believe that I can write a small plugin to extend (ie: monkey-patch) this clappr-chromecast-plugin to add support for before digging into code, lets start with some Clappr settings to test text tracks: // -----------------------------------------------
// references:
// https://github.com/clappr/clappr/issues/1477
// -----------------------------------------------
var initialize_text_tracks = function() {
var video = document.querySelector('video')
if (!video) return
var textTracks = video.textTracks
if (!textTracks || !textTracks.length) return
for (var i=0; i < textTracks.length; i++) {
if (textTracks[i].mode === 'showing') return
}
// turn on the first subtitles text track (which is always "Disabled") to display the "CC" icon/menu in the media-control panel
textTracks[0].mode = 'showing'
}
// -----------------------------------------------
// references:
// http://demo.theoplayer.com/closed-captions-subtitles
// https://github.com/videojs/video.js/tree/v7.10.2/docs/examples/elephantsdream
// -----------------------------------------------
var player = new Clappr.Player({
source: 'https://cdn.theoplayer.com/video/elephants-dream/playlist-single-audio.m3u8', // in-stream WebVTT: Chinese, French
poster: 'https://demo.theoplayer.com/hubfs/Demo_zone/elephants-dream.jpg',
height: 360,
width: 640,
plugins: [ChromecastPlugin],
chromecast: {
appId: '9DFB77C0',
media: {
type: ChromecastPlugin.Movie,
title: 'Elephants Dream',
subtitle: '2006 Dutch computer animated science fiction fantasy experimental short film produced by Blender Foundation'
}
},
playback: {
crossOrigin: 'anonymous',
externalTracks: [{
lang: 'en-US',
label: 'English',
kind: 'subtitles',
src: 'https://raw.githubusercontent.com/videojs/video.js/v7.10.2/docs/examples/elephantsdream/captions.en.vtt'
},{
lang: 'sv',
label: 'Swedish',
kind: 'subtitles',
src: 'https://raw.githubusercontent.com/videojs/video.js/v7.10.2/docs/examples/elephantsdream/captions.sv.vtt'
},{
lang: 'ru',
label: 'Russian',
kind: 'subtitles',
src: 'https://raw.githubusercontent.com/videojs/video.js/v7.10.2/docs/examples/elephantsdream/captions.ru.vtt'
},{
lang: 'ja',
label: 'Japanese',
kind: 'subtitles',
src: 'https://raw.githubusercontent.com/videojs/video.js/v7.10.2/docs/examples/elephantsdream/captions.ja.vtt'
},{
lang: 'ar',
label: 'Arabic',
kind: 'subtitles',
src: 'https://raw.githubusercontent.com/videojs/video.js/v7.10.2/docs/examples/elephantsdream/captions.ar.vtt'
}]
},
events: {
onPlay: initialize_text_tracks
}
}); observations without any changes to Clappr:
necessary changes to settings to continue with testing: var player = new Clappr.Player({
source: 'https://d2zihajmogu5jn.cloudfront.net/elephantsdream/ed_hd.mp4',
...
});
I think that's a fairly thorough summary of where I'm at right now. As I said, I'm going after the low-hanging fruit.. and will report back with any progress. |
imho, it works great; feedback (and PRs) welcome 😃 PS, the live demo doesn't set PS, regarding clappr#1477, the |
Hi,
Is there any subtitle support on chromecast? We have external track with VTT format, how we can send them with chromecast?
Thanks,
Salih
The text was updated successfully, but these errors were encountered: