Fix start time with web video player
This commit is contained in:
parent
2809ebbc20
commit
049f50bc32
4 changed files with 5 additions and 10 deletions
|
@ -168,8 +168,7 @@ export class PeerTubePlayer {
|
||||||
const webVideoOptionsBuilder = new WebVideoOptionsBuilder(pick(this.currentLoadOptions, [
|
const webVideoOptionsBuilder = new WebVideoOptionsBuilder(pick(this.currentLoadOptions, [
|
||||||
'videoFileToken',
|
'videoFileToken',
|
||||||
'webVideo',
|
'webVideo',
|
||||||
'hls',
|
'hls'
|
||||||
'startTime'
|
|
||||||
]))
|
]))
|
||||||
|
|
||||||
this.player.webVideo(webVideoOptionsBuilder.getPluginOptions())
|
this.player.webVideo(webVideoOptionsBuilder.getPluginOptions())
|
||||||
|
|
|
@ -409,11 +409,10 @@ class PeerTubePlugin extends Plugin {
|
||||||
|
|
||||||
// Prefer canplaythrough instead of canplay because Chrome has issues with the second one
|
// Prefer canplaythrough instead of canplay because Chrome has issues with the second one
|
||||||
this.player.one('canplaythrough', () => {
|
this.player.one('canplaythrough', () => {
|
||||||
if (this.options.startTime()) {
|
const startTime = this.options.startTime() || 0
|
||||||
debugLogger('Start the video at ' + this.options.startTime())
|
debugLogger('Start the video at ' + startTime)
|
||||||
|
|
||||||
this.player.currentTime(timeToInt(this.options.startTime()))
|
this.player.currentTime(timeToInt(startTime))
|
||||||
}
|
|
||||||
|
|
||||||
if (this.options.stopTime()) {
|
if (this.options.stopTime()) {
|
||||||
const stopTime = timeToInt(this.options.stopTime())
|
const stopTime = timeToInt(this.options.stopTime())
|
||||||
|
|
|
@ -14,9 +14,7 @@ export class WebVideoOptionsBuilder {
|
||||||
|
|
||||||
videoFiles: this.options.webVideo.videoFiles.length !== 0
|
videoFiles: this.options.webVideo.videoFiles.length !== 0
|
||||||
? this.options.webVideo.videoFiles
|
? this.options.webVideo.videoFiles
|
||||||
: this.options?.hls.videoFiles || [],
|
: this.options?.hls.videoFiles || []
|
||||||
|
|
||||||
startTime: this.options.startTime
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,6 @@ type TheaterButtonOptions = {
|
||||||
|
|
||||||
type WebVideoPluginOptions = {
|
type WebVideoPluginOptions = {
|
||||||
videoFiles: VideoFile[]
|
videoFiles: VideoFile[]
|
||||||
startTime: number | string
|
|
||||||
videoFileToken: () => string
|
videoFileToken: () => string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue