]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/standalone/videos/embed-api.ts
Fix webpack config
[github/Chocobozzz/PeerTube.git] / client / src / standalone / videos / embed-api.ts
index efc23a1fc786c6b0f0a0d49255b3385978d3e1eb..75174f2f8ef2a6eca1362ab52db7d3e7b8234001 100644 (file)
@@ -50,6 +50,10 @@ export class PeerTubeEmbedApi {
     channel.bind('setPlaybackRate', (txn, playbackRate) => this.embed.player.playbackRate(playbackRate))
     channel.bind('getPlaybackRate', (txn, params) => this.embed.player.playbackRate())
     channel.bind('getPlaybackRates', (txn, params) => this.embed.player.options_.playbackRates)
+
+    channel.bind('playNextVideo', (txn, params) => this.embed.playNextVideo())
+    channel.bind('playPreviousVideo', (txn, params) => this.embed.playPreviousVideo())
+    channel.bind('getCurrentPosition', (txn, params) => this.embed.getCurrentPosition())
     this.channel = channel
   }
 
@@ -136,12 +140,14 @@ export class PeerTubeEmbedApi {
     })
 
     // PeerTube specific capabilities
-
     if (this.isWebtorrent()) {
       this.embed.player.webtorrent().on('autoResolutionUpdate', () => this.loadWebTorrentResolutions())
       this.embed.player.webtorrent().on('videoFileUpdate', () => this.loadWebTorrentResolutions())
+
+      this.loadWebTorrentResolutions()
     } else {
       this.embed.player.p2pMediaLoader().on('resolutionChange', () => this.loadP2PMediaLoaderResolutions())
+      this.embed.player.p2pMediaLoader().on('resolutionsLoaded', () => this.loadP2PMediaLoaderResolutions())
     }
 
     this.embed.player.on('volumechange', () => {
@@ -203,6 +209,6 @@ export class PeerTubeEmbedApi {
   }
 
   private isWebtorrent () {
-    return this.embed.player.webtorrent
+    return !!this.embed.player.webtorrent
   }
 }