return this.currentVideoFile ? this.currentVideoFile.resolution.id : -1
}
+ private getVideoFile(): VideoFile {
+ const savedAverageBandwidth = getAverageBandwidthInStore()
+ return savedAverageBandwidth
+ ? this.getAppropriateFile(savedAverageBandwidth)
+ : this.pickAverageVideoFile()
+}
+
updateVideoFile (
- videoFile?: VideoFile,
+ videoFile: VideoFile,
options: {
forcePlay?: boolean,
seek?: number,
} = {},
done: () => void = () => { /* empty */ }
) {
- // Automatically choose the adapted video file
- if (videoFile === undefined) {
- const savedAverageBandwidth = getAverageBandwidthInStore()
- videoFile = savedAverageBandwidth
- ? this.getAppropriateFile(savedAverageBandwidth)
- : this.pickAverageVideoFile()
- }
-
if (videoFile === undefined) {
throw Error(`Can't update video file since videoFile is undefined.`)
}
if (this.autoplay) {
this.player.posterImage.hide()
- return this.updateVideoFile(undefined, { forcePlay: true, seek: this.startTime })
+ return this.updateVideoFile(this.getVideoFile(), { forcePlay: true, seek: this.startTime })
}
// Proxy first play
this.player.addClass('vjs-has-big-play-button-clicked')
this.player.play = oldPlay
- this.updateVideoFile(undefined, { forcePlay: true, seek: this.startTime })
+ this.updateVideoFile(this.getVideoFile(), { forcePlay: true, seek: this.startTime })
}
}