Open
Description
Have you read the Tutorials?
Yes
Have you read the FAQ and checked for duplicate open issues?
Yes
If the question is related to FairPlay, have you read the tutorial?
Question is not related to FairPlay.
What version of Shaka Player are you using?
4.11.11
What browser and OS are you using?
All modern browsers like chrome, firefox, safari etc.
Please ask your question
We are creating a reels (verticle videos) kind of platform using single shaka player. We are preloading adjacent videos for smoother experience. Kindly, help me find answer to below question:
- What all things does preload manager download? Is it segment/s of quality, audio or subtitle or subset of these. This will be helpful in knowing when to trigger preload api for adjacent videos. For e.g.
// Preload data
const previousPreloadManager = await player.preload(url1); // quality -> 720p, audio -> en, subtitle -> en
const currentPreloadManager = await player.preload(url2); // quality -> 720p, audio -> en, subtitle -> en
const nextPreloadManager = await player.preload(url3); // quality -> 720p, audio -> en, subtitle -> en
// Do we need to update previousPreloadManager and nextPreloadManager in following cases ?
// 1. Customer changes quality to 1080p in current video.
// 2. Customer changes audio to "hi" in current video.
// 3. Customer changes subtitle to "hi" in current video.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
avelad commentedon Feb 27, 2025
Currently I don't think we have any API to do what you want, but let @theodab who made this confirm :)
AdityaSinghShekhawat commentedon Feb 28, 2025
@avelad Thanks for the reply. Just to clarify, I want to know what things does preload api downloads? That is, does it download video segments only or does it download audio and subtitles data as well. @theodab can you pls confirm. Thanks in advance. 🙂
avelad commentedon Feb 28, 2025
I created to improve a bit the preload manager: #8187
It doesn't change how to update (not possible at the moment), but it helps to preload the subtitles and to know which track has been preloaded.
shaka-bot commentedon Mar 4, 2025
@AdityaSinghShekhawat Does this answer all your questions? If so, would you please close the issue?
joeyparrish commentedon Mar 6, 2025
@AdityaSinghShekhawat, with @avelad's change, it now preloads audio, video, and text. Previously, it only preloaded audio and video. The goal of preload is to start very quickly by having the first segments cached in memory.
You may disagree, but I don't think it's super important to change the preloaded segments from 720p to 1080p when the currently-playing video changes. And doing something like that may even be harmful to your users in some cases.
If your segments are small, and we're talking about 720p vs 1080p, it won't be very noticeable to the user. For 2s segments, you'll have 2s of data at 720p. And will that be incredibly critical content, or a logo for a TV show? Or fading in from black?
In those 2s, the next segment to be fetched will be based on Shaka's profile of the user's bandwidth. Maybe it's even lower! You could have preloaded 720p segments, but then during playback on a mobile device, find that only 480p is sustainable. You'd really prefer not to waste bandwidth re-downloading that 720p segment at 480p if you're already short on bandwidth.
It's also feasible that during the presentation of a long video, many adaptations are necessary. If you throw away your preloaded segments for future videos every time that happens, you could be wasting a lot.
These are my opinions, and why I would not recommend an API or automatic feature to change the preloaded segments after the fact. Happy to debate it, though, and I've been wrong here many times in the past. 😁
AdityaSinghShekhawat commentedon Mar 9, 2025
@joeyparrish Thanks for the reply. I agree we should not update preloaded segments after quality change but we need to update segments when audio/text is changed. As this would affect user experience. For e.g., a video started with Italian and user don't know Italian and hence changed it to let's say English. If we don't preload English audio for adjacent videos then next video would be played in Italian for sometime which is a bad CX.
joeyparrish commentedon Mar 9, 2025
Ah, that makes sense. Then I think there need to be some performance caveats for this. For example, it's probably wise to avoid preloading more than one presentation ahead of the one you're on in a playlist. You should probably wait for audio & text changes in the current presentation to settle for a certain period before applying them to the preload for the next presentation in the playlist. (You wouldn't want the user switching rapidly and the player to download lots of language updates in a row.)
That said, we don't have an API for this yet AFAIK.
[-]Preload Manager: Configuration and Update Scenarios[/-][+]Preload Manager: Update language configuration for audio and text[/+]joeyparrish commentedon Mar 9, 2025
I'm renaming this and marking it as a P2 feature request.