Have you read the FAQ and checked for duplicate open issues?
Yes
What version of Shaka Player are you using?
2.5.9
Please ask your question
Hi there. My question is: how to extract the video src from the player?
I would need a way to get direct access to the video source url (result of the manifest processed by the player), instead of the player object.
Thanks! :)
There are two ways to get the URL we're playing:
video.src, where video is the video element. For DASH & HLS content played through MediaSource, this will be something like blob:https://shaka-player-demo.appspot.com/034c1bee-64a9-48fb-a619-562350c9b69a, which isn't super useful. For plain MP4 or WebM files, this will be the URL.player.getAssetUri() will always return the same string passed to player.load(), so this will do what you expect for DASH & HLS. Docs here: https://shaka-player-demo.appspot.com/docs/api/shaka.Player.html#getAssetUriDoes this help?
Thanks for the fast reply!
I am trying to implement the player in a WebXR application which works among others with video nodes supporting HTML 5 videos.
Thinking about the process of the player in processing the manifests, after the various evaluation of the constraints to choose real time the best adaptive quality, the very last output of this elaboration should be an mp4 or something like and the HTML video element will be fed with it.
What I would need is a method to return an object with an extension supported by HTML 5 video processing like mp4 (that's the very last output above).
I don't know if such a method is provided, but I hope you understood the problem and you can help me :)
I don't know if such a method is provided, but I hope you understood the problem and you can help me :)
I'm sorry, but I don't understand the problem, but I'll do my best to help.
Thinking about the process of the player in processing the manifests, after the various evaluation of the constraints to choose real time the best adaptive quality, the very last output of this elaboration should be an mp4 or something like and the HTML video element will be fed with it.
Perhaps we have a misunderstanding about how adaptive playback works.
If you are playing DASH or HLS content, the player will choose the best streams for you, but the output is not a single MP4 which is fed to the video element. Instead, we continually re-evaluate, and each segment of the presentation may come from a different stream.
For example, the first few seconds of playback may be at resolution A, and the next few seconds may be at resolution B. Or the user may switch audio languages, so we stop fetching English audio and start fetching Spanish.
Does this help?
Yes, I have understood the functioning.
I am asking if a way to provide the different MP4 URL streams chosen each time they switch is included in the API.
I am asking if a way to provide the different MP4 URL streams chosen each time they switch is included in the API.
I'm sorry, I don't know what this means. Are you asking for the URL of the chosen stream every time a decision is made?
Yes, that's what I mean.
We don't have an API for that exactly. A segment is more than just a URL. And so is a stream. Sometimes segments each have their own URL, or sometimes each segment in a stream is a byte range from a single URL.
If you want to monitor network activity, we have an API that would allow you to see what requests we're making, including URLs and byte ranges.
If you want to monitor ABR decisions, there is an even you can listen for on Player to say when we change streams. You can then check what the active track is, and work out what stream we're in based on that. Or, you could get access to the parsed manifest (which is not a stable structure across minor number releases) and get access to streams, segment indexes, etc.
Does any of that sound helpful?
If you want to monitor network activity, we have an API that would allow you to see what requests we're making, including URLs and byte ranges.
Which is the API you are talking about?
If you want to monitor ABR decisions, there is an even you can listen for on Player to say when we change streams. You can then check what the active track is, and work out what stream we're in based on that. Or, you could get access to the parsed manifest (which is not a stable structure across minor number releases) and get access to streams, segment indexes, etc.
What do you mean for even?
Does any of that sound helpful?
Yes thanks, you are so kind!
If you want to monitor network activity, we have an API that would allow you to see what requests we're making, including URLs and byte ranges.
Which is the API you are talking about?
You can use request filters to intercept and/or modify requests:
const networkingEngine = player.getNetworkingEngine();
networkingEngine.registerRequestFilter((type, request) => {
if (type == shaka.net.NetworkingEngine.RequestType.SEGMENT) {
const uri = request.uris[0];
const range = request.headers['range'];
console.log('Do something with', uri, range);
}
});
Some relevant doc links:
If you want to monitor ABR decisions, there is an even you can listen for on Player to say when we change streams. You can then check what the active track is, and work out what stream we're in based on that. Or, you could get access to the parsed manifest (which is not a stable structure across minor number releases) and get access to streams, segment indexes, etc.
What do you mean for even?
Sorry, I made a typo. I meant there is an event you can listen for. Here's an example:
player.addEventListener('adaptation', () => {
const activeTrack = player.getVariantTracks().find((t) => t.active);
});
Some relevant doc links:
Here's how you could get the parsed manifest structure:
await player.load('foo.mpd');
const manifest = player.getManifest();
Some relevant doc links:
Does this help?
@Milomitic Does this answer all your questions? Can we close the issue?
Closing due to inactivity. If this is still an issue for you or if you have further questions, you can ask us to reopen or have the bot reopen it by including @shaka-bot reopen in a comment.