is it support subtitles ?
Opened this issue · 4 comments
hi, thank you @Lindsay-Needs-Sleep for handling this plugin
I'm just coming to ask if this plugin support subtitle??, trying a lot of tricks to make it work, but still nothing, the subtitle didn't show
my console log for [this.castMedia] :
"tracks":[
{
"trackId"=1,
"type":"VIDEO",
"trackContentType":null,
"trackContentId":"null",
"subtype":'null',
"name":'null',
"language":'null',
"customData":'null'
}
]
code using for
var videoUrl = 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-576p.mp4';
var thesub = 'https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt';
const englishSubtitle = new chrome.cast.media.Track(1,chrome.cast.media.TrackType.TEXT);
englishSubtitle.trackContentId =thesub ;
englishSubtitle.trackContentType = 'text/vtt';
englishSubtitle.subtype = chrome.cast.media.TextTrackType.SUBTITLES;
englishSubtitle.name = 'English';
englishSubtitle.language = 'en-US';
englishSubtitle.customData = null;
var tracks = [englishSubtitle];
var mediaInfo = new chrome.cast.media.MediaInfo(videoUrl);
/**/ mediaInfo.tracks = tracks;
mediaInfo.activeTrackIds = [1];
this.isCasting = true;
this.castSession.loadMedia(new chrome.cast.media.LoadRequest(mediaInfo), (media:any)=> {
// You should see the video playing now!
// Got media!
this.castMedia = media;
alert(JSON.stringify(this.castMedia, null, 2));
}, function (err) {
// Failed (check that the video works in your browser)
// alert("Failed : check that the video works in your browser")
alert(JSON.stringify(err, null, 2));
this.isCasting = false;
});
This was a feature I wanted to test, but I didn't have access to any subtitle tracks (and no general knowledge about how subtitles work / how to generate / etc).
We're probably missing a small piece of code that enables them.
Have you tried on android and ios? (there's a tiny chance that one of them already has the subtitle logic.)
If not, I think this shouldn't be too hard to add.
I don't have to time to get the project to build and test right now, but if you are interested in doing it, I can provide some guidance possibly.
The first step would be confirming that your javascript works on a regular desktop chrome browser. (I'm guessing you have done that already.)
This was a feature I wanted to test, but I didn't have access to any subtitle tracks (and no general knowledge about how subtitles work / how to generate / etc).
We're probably missing a small piece of code that enables them.
at first, I have doubted this issue may be related to CORS but i think it's excluded now :)
Have you tried on android and ios? (there's a tiny chance that one of them already has the subtitle logic.)
I'm currently on android using ionic framework, did you have any other logic can help??
I don't have to time to get the project to build and test right now, but if you are interested in doing it, I can provide some guidance possibly.
The first step would be confirming that your javascript works on a regular desktop chrome browser. (I'm guessing you have done that already.)
I'm really intersting to figure out this issue but i'm not have a large experience for something like that due to my limitation
anaway just let me know what do as possible as i can :)
@megasto If you are still looking for this feature (or for any other folks that may come along) I implemented this for Android builds in my forked version of this plugin. https://github.com/pdille/cordova-plugin-chromecast
While it could be refactored slightly, it works for my needs and anyone else is welcome to use it.
Thank you @pdille you are my hero,
I'm using your fork and its working fine for me on Android,
Can you implement the same fix for iOS please ?.