aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets')
-rw-r--r--client/src/assets/images/global/play.html9
-rw-r--r--client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts12
-rw-r--r--client/src/assets/player/peertube-plugin.ts10
3 files changed, 28 insertions, 3 deletions
diff --git a/client/src/assets/images/global/play.html b/client/src/assets/images/global/play.html
new file mode 100644
index 000000000..d00122de4
--- /dev/null
+++ b/client/src/assets/images/global/play.html
@@ -0,0 +1,9 @@
1<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2 <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linejoin="round">
3 <g id="Artboard-4" transform="translate(-532.000000, -115.000000)" stroke-width="2" stroke="#000000">
4 <g id="12" transform="translate(532.000000, 115.000000)">
5 <polygon id="Triangle-1" points="5 21 5 3 21 12" fill="#000000"/>
6 </g>
7 </g>
8 </g>
9</svg>
diff --git a/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts b/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts
index 4dbfda300..bbd3e008d 100644
--- a/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts
+++ b/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts
@@ -4,6 +4,7 @@ import * as videojs from 'video.js'
4import { P2PMediaLoaderPluginOptions, PlayerNetworkInfo, VideoJSComponentInterface } from '../peertube-videojs-typings' 4import { P2PMediaLoaderPluginOptions, PlayerNetworkInfo, VideoJSComponentInterface } from '../peertube-videojs-typings'
5import { Engine, initHlsJsPlayer, initVideoJsContribHlsJsPlayer } from 'p2p-media-loader-hlsjs' 5import { Engine, initHlsJsPlayer, initVideoJsContribHlsJsPlayer } from 'p2p-media-loader-hlsjs'
6import { Events } from 'p2p-media-loader-core' 6import { Events } from 'p2p-media-loader-core'
7import { timeToInt } from '../utils'
7 8
8// videojs-hlsjs-plugin needs videojs in window 9// videojs-hlsjs-plugin needs videojs in window
9window['videojs'] = videojs 10window['videojs'] = videojs
@@ -32,6 +33,7 @@ class P2pMediaLoaderPlugin extends Plugin {
32 totalDownload: 0, 33 totalDownload: 0,
33 totalUpload: 0 34 totalUpload: 0
34 } 35 }
36 private startTime: number
35 37
36 private networkInfoInterval: any 38 private networkInfoInterval: any
37 39
@@ -54,12 +56,14 @@ class P2pMediaLoaderPlugin extends Plugin {
54 56
55 initVideoJsContribHlsJsPlayer(player) 57 initVideoJsContribHlsJsPlayer(player)
56 58
59 this.startTime = timeToInt(options.startTime)
60
57 player.src({ 61 player.src({
58 type: options.type, 62 type: options.type,
59 src: options.src 63 src: options.src
60 }) 64 })
61 65
62 player.on('play', () => { 66 player.one('play', () => {
63 player.addClass('vjs-has-big-play-button-clicked') 67 player.addClass('vjs-has-big-play-button-clicked')
64 }) 68 })
65 69
@@ -92,6 +96,12 @@ class P2pMediaLoaderPlugin extends Plugin {
92 this.statsP2PBytes.numPeers = 1 + this.options.redundancyBaseUrls.length 96 this.statsP2PBytes.numPeers = 1 + this.options.redundancyBaseUrls.length
93 97
94 this.runStats() 98 this.runStats()
99
100 this.hlsjs.on('hlsLevelLoaded', () => {
101 if (this.startTime) this.player.currentTime(this.startTime)
102
103 this.hlsjs.off('hlsLevelLoaded', this)
104 })
95 } 105 }
96 106
97 private runStats () { 107 private runStats () {
diff --git a/client/src/assets/player/peertube-plugin.ts b/client/src/assets/player/peertube-plugin.ts
index 3991e4627..dd9408c8e 100644
--- a/client/src/assets/player/peertube-plugin.ts
+++ b/client/src/assets/player/peertube-plugin.ts
@@ -83,9 +83,15 @@ class PeerTubePlugin extends Plugin {
83 83
84 if (options.stopTime) { 84 if (options.stopTime) {
85 const stopTime = timeToInt(options.stopTime) 85 const stopTime = timeToInt(options.stopTime)
86 const self = this
86 87
87 this.player.on('timeupdate', () => { 88 this.player.on('timeupdate', function onTimeUpdate () {
88 if (this.player.currentTime() > stopTime) this.player.pause() 89 if (self.player.currentTime() > stopTime) {
90 self.player.pause()
91 self.player.trigger('stopped')
92
93 self.player.off('timeupdate', onTimeUpdate)
94 }
89 }) 95 })
90 } 96 }
91 97