}
private get element () {
- return this.embed.videoElement
+ return this.embed.playerElement
}
private constructChannel () {
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
}
setInterval(() => {
const position = this.element.currentTime
const volume = this.element.volume
- const duration = this.element.duration
this.channel.notify({
method: 'playbackStatusUpdate',
})
// 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', () => {
}
private isWebtorrent () {
- return this.embed.player.webtorrent
+ return !!this.embed.player.webtorrent
}
}