aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorBigard Florian <florian.bigard@gmail.com>2017-07-19 14:07:52 +0200
committerGitHub <noreply@github.com>2017-07-19 14:07:52 +0200
commit78d5b1893decae252c806f46fa45d07112da4897 (patch)
tree2fdd64cb25dd448a099b5c1f6695a34ffa569548 /client/src
parent0b7db72af30403fb6c7d906a4c239a5519cf934d (diff)
downloadPeerTube-78d5b1893decae252c806f46fa45d07112da4897.tar.gz
PeerTube-78d5b1893decae252c806f46fa45d07112da4897.tar.zst
PeerTube-78d5b1893decae252c806f46fa45d07112da4897.zip
Fix player on embed
Diffstat (limited to 'client/src')
-rw-r--r--client/src/standalone/videos/embed.html22
1 files changed, 16 insertions, 6 deletions
diff --git a/client/src/standalone/videos/embed.html b/client/src/standalone/videos/embed.html
index 365dc3fa2..d4bb74263 100644
--- a/client/src/standalone/videos/embed.html
+++ b/client/src/standalone/videos/embed.html
@@ -71,7 +71,7 @@
71 xhttp.send() 71 xhttp.send()
72 } 72 }
73 73
74 function loadVideoTorrent (magnetUri) { 74 function loadVideoTorrent (magnetUri, player) {
75 console.log('Loading video ' + videoId) 75 console.log('Loading video ' + videoId)
76 var client = new window.WebTorrent() 76 var client = new window.WebTorrent()
77 77
@@ -79,7 +79,19 @@
79 client.add(magnetUri, function (torrent) { 79 client.add(magnetUri, function (torrent) {
80 var file = torrent.files[0] 80 var file = torrent.files[0]
81 81
82 file.renderTo('video', { autoplay: true }) 82 file.renderTo('video', function (err) {
83 if (err) {
84 console.error(err)
85 return
86 }
87
88 // Hack to "simulate" src link in video.js >= 6
89 // If no, we can't play the video after pausing it
90 // https://github.com/videojs/video.js/blob/master/src/js/player.js#L1633
91 player.src = function () { return true }
92
93 player.play()
94 })
83 }) 95 })
84 } 96 }
85 97
@@ -127,13 +139,11 @@
127 }) 139 })
128 140
129 document.querySelector('.vjs-big-play-button').addEventListener('click', function () { 141 document.querySelector('.vjs-big-play-button').addEventListener('click', function () {
130 loadVideoTorrent(magnetUri) 142 loadVideoTorrent(magnetUri, player)
131
132 player.play()
133 }, false) 143 }, false)
134 }) 144 })
135 }) 145 })
136 146
137 </script> 147 </script>
138 </body> 148 </body>
139</html> 149</html