this.playerElement = options.playerElement
this.player.ready(() => {
- this.initializePlayer(options)
+ this.initializePlayer()
this.runTorrentInfoScheduler()
this.runViewAdd()
})
const options = { autoplay: true, controls: true }
renderVideo(torrent.files[0], this.playerElement, options,(err, renderer) => {
+ this.renderer = renderer
+
if (err) return this.fallbackToHttp()
- this.renderer = renderer
if (!this.player.paused()) {
const playPromise = this.player.play()
if (playPromise !== undefined) return playPromise.then(done)
this.updateVideoFile(undefined, () => this.player.play())
}
- private initializePlayer (options: PeertubePluginOptions) {
+ private initializePlayer () {
if (this.autoplay === true) {
this.updateVideoFile(undefined, () => this.player.play())
} else {
const codecs = getCodec(file.name, useVP9)
prepareElem()
- preparedElem.addEventListener('error', function onError(err) {
- // Try with vp9 before returning an error
- if (codecs.indexOf('vp8') !== -1) {
- preparedElem.removeEventListener('error', onError)
+ preparedElem.addEventListener('error', function onError (err) {
+ preparedElem.removeEventListener('error', onError)
- return fallbackToMediaSource(true)
- }
+ // Try with vp9 before returning an error
+ if (codecs.indexOf('vp8') !== -1) return fallbackToMediaSource(true)
return callback(err)
})