From 1f6824c958440ace14f7c7f83c890b848a71f5d9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 16 Jul 2018 16:13:35 +0200 Subject: Improve start time param Can handle 2m42s for example --- client/src/assets/player/peertube-videojs-plugin.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'client/src/assets/player/peertube-videojs-plugin.ts') diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index 3f6fc4cc6..0dcbe49b1 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts @@ -4,7 +4,7 @@ import { VideoFile } from '../../../../shared/models/videos/video.model' import { renderVideo } from './video-renderer' import './settings-menu-button' import { PeertubePluginOptions, VideoJSCaption, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' -import { isMobile, videoFileMaxByResolution, videoFileMinByResolution } from './utils' +import { isMobile, videoFileMaxByResolution, videoFileMinByResolution, timeToInt } from './utils' import * as CacheChunkStore from 'cache-chunk-store' import { PeertubeChunkStore } from './peertube-chunk-store' import { @@ -76,7 +76,7 @@ class PeerTubePlugin extends Plugin { // Disable auto play on iOS this.autoplay = options.autoplay && this.isIOS() === false - this.startTime = options.startTime + this.startTime = timeToInt(options.startTime) this.videoFiles = options.videoFiles this.videoViewUrl = options.videoViewUrl this.videoDuration = options.videoDuration @@ -264,8 +264,8 @@ class PeerTubePlugin extends Plugin { // Magnet hash is not up to date with the torrent file, add directly the torrent file if (err.message.indexOf('incorrect info hash') !== -1) { console.error('Incorrect info hash detected, falling back to torrent file.') - const options = { forcePlay: true } - return this.addTorrent(this.torrent['xs'], previousVideoFile, options, done) + const newOptions = { forcePlay: true, seek: options.seek } + return this.addTorrent(this.torrent['xs'], previousVideoFile, newOptions, done) } return console.warn(err) -- cgit v1.2.3