-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
How to display a side loaded text track by default when using chromecast? #3370
Comments
That makes sense. The way the current Cast API works, it transmits the manifest URL to the device, where playback then starts and seeks to the same position. The way addTextTrackAsync works is by inserting a synthetic track to the parsed manifest. This is not transmitted to the Cast device when you start casting. It's reasonable for you to expect this to work, though. We should find a way to fix this. I'm going to reclassify this as a bug. As for a fix, here's one suggestion: We could potentially track metadata about side-loaded tracks in the player, separately from the manifest, and transmit this to the Cast device when we start casting. I don't have any other ideas off-hand. For now, though, you can work around this in the receiver by calling addTextTrackAsync again on the cast side. For example: // Sender side code.
// If using our UI, this gets you the CastProxy object.
// If you're not using our UI, you created this object yourself.
const castProxy = video.ui.getControls().getCastProxy();
// Set "app data" for the asset. This can be anything you can serialize over JSON.
// In this example, I'm sending most of the params of addTextTrackAsync.
// You can choose what you send, though. Always use VTT?
// Hard-code the MIME type in your receiver if you like instead of sending it.
castProxy.setAppData({
sideLoadedText: {
uri: 'foo',
language: 'es',
kind: 'subtitle',
mimeType: 'text/vtt',
},
}); // Receiver-side code.
// Use the app data callback to get the data from the sender app.
const receiver = new shaka.cast.CastReceiver(
video, player, (appData) => {
if (appData.sideLoadedText) {
// Use the app data to side-load the text track on the receiver side.
player.addTextTrackAsync(
appData.sideLoadedText.uri,
appData.sideLoadedText.language,
appData.sideLoadedText.kind,
appData.sideLoadedText.mimeType);
}
}); |
Since we want to do #4214 I'm going to close this issue. |
Have you read the Tutorials?
yes
Have you read the FAQ and checked for duplicate open issues?
yes
What version of Shaka Player are you using?
3.0.10
Please ask your question
I have side loaded text tracks which load/render properly during playback in a browser, but these aren't showing up by default when casting, instead it's turning the caption selector to its off state, if i manually select a track then gets displayed.
The text tracks are being loaded after the player had fired the loaded event, using
addTextTrackAsync
and awaiting that promise (side note: sometimes even if it's awaited it doesn't return the track), then selected and its visibility set totrue
.Is there anything in particular that needs to happen to display side loaded text tracks by default when casting?
The text was updated successfully, but these errors were encountered: