Closed the-fine closed 10 years ago
Of course you can do it ! I'll gladly review your pull request and provide any help Le 16 août 2014 16:28, "the-fine" notifications@github.com a écrit :
Is it possible to add VTT text track support? It is supported on the DefaultMediaReceiver
— Reply to this email directly or view it on GitHub https://github.com/thibauts/node-castv2-client/issues/5.
Any progress on this? Would love to see track support in this module
totally forgot about this, don't think i have the knowledge to do this :(
Good news, I got them working after a great deal of trial and error as I couldn't find exemple code or traffic to snoop on.
A minor update to the module is needed. Then I'll try to post exemple code here.
That's brilliant news. Thank you very much
The client as well as the core protocol module have been updated and pushed to npm. Please rerun an npm install
in your projects to get the latest versions.
Here is exemple code to try VTT support :
var Client = require('castv2-client').Client;
var DefaultMediaReceiver = require('castv2-client').DefaultMediaReceiver;
var mdns = require('mdns');
var browser = mdns.createBrowser(mdns.tcp('googlecast'));
browser.on('serviceUp', function(service) {
console.log('found device "%s" at %s:%d', service.name, service.addresses[0], service.port);
ondeviceup(service.addresses[0]);
browser.stop();
});
browser.start();
function ondeviceup(host) {
var client = new Client();
client.connect(host, function() {
console.log('connected, launching app ...');
client.launch(DefaultMediaReceiver, function(err, player) {
var media = {
contentId: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4',
contentType: 'video/mp4',
streamType: 'BUFFERED',
// !!! VTT: Here additional tracks are specified, only VTT is currently supported by the DefaultMediaReceiver.
tracks: [{
trackId: 1,
type: 'TEXT',
trackContentId: 'https://raw.githubusercontent.com/googlecast/CastClosedCaptioning-chrome/master/captions_styled.vtt',
trackContentType: 'text/vtt',
name: 'English',
language: 'en-US',
subtype: 'SUBTITLES'
}]
};
player.on('status', function(status) {
console.log('status broadcast playerState=%s', status.playerState);
});
console.log('app "%s" launched, loading media %s ...', player.session.displayName, media.contentId);
// !!! VTT: You have to tell the Chromecast which trackIds to play with activetrackIds.
player.load(media, { autoplay: true, activeTrackIds: [1] }, function(err, status) {
if(err) {
client.close();
console.log(err);
return;
}
console.log('media loaded playerState=%s', status.playerState);
});
});
});
client.on('error', function(err) {
console.log('Error: %s', err.message);
client.close();
});
}
Check the comments to see how it works. Note that the server(s) delivering BOTH the video stream and the VTT file have to be CORS enabled. The video and the subtitles can come from a different server/host/domain though.
Tell me how it goes for you so I can close the issue if everything is OK.
Brilliant work. I was actually super close to doing exactly what you did on the module last night, but I just gave up.
I'll give this a try tonight
I can understand your frustration as there is no way to know if you're getting close to the goal until every single param falls exactly into place ...
Let me know how things go. Anyway there is still work left on subtitle styling, but I think it will be much easier to tinker with it following the API docs.
Works absolutely perfectly. Great work
Definitely works as expected, closing !
Hello, Making some tests again and executing that same example script it does stream the movie/mp4 but for some reason it doesn't show the subtitles. Am I the only one with this problem?
The github server no longer mirrors the origin header. It definitely works with a properly configured server.
@thibauts do you know how the captions can be styled? For a bigger font size for example. In the example vtt
there are some css
classes used but how do we provide the css
?
Is it possible to add VTT text track support? It is supported on the DefaultMediaReceiver