fix: pass current abr estimatedBandwidth to preloadManager
This commit is contained in:
parent
d7cbaa454d
commit
54e337d8d7
1 changed files with 9 additions and 1 deletions
10
js/player.js
10
js/player.js
|
|
@ -548,7 +548,15 @@ export class Player {
|
|||
if (streamUrl.includes('.mpd') || streamUrl.includes('.m3u8')) {
|
||||
if (this.shakaInitialized && this.shakaPlayer && typeof this.shakaPlayer.preload === 'function') {
|
||||
try {
|
||||
const preloadManager = await this.shakaPlayer.preload(streamUrl);
|
||||
let preloadConfig = undefined;
|
||||
if (typeof this.shakaPlayer.getConfiguration === 'function') {
|
||||
preloadConfig = this.shakaPlayer.getConfiguration();
|
||||
const stats = typeof this.shakaPlayer.getStats === 'function' ? this.shakaPlayer.getStats() : null;
|
||||
if (stats && stats.estimatedBandwidth) {
|
||||
preloadConfig.abr.defaultBandwidthEstimate = stats.estimatedBandwidth;
|
||||
}
|
||||
}
|
||||
const preloadManager = await this.shakaPlayer.preload(streamUrl, null, null, preloadConfig);
|
||||
streamInfo.preloadManager = preloadManager;
|
||||
} catch (e) {
|
||||
// Ignore preload errors, will just load fresh
|
||||
|
|
|
|||
Loading…
Reference in a new issue