Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions src/players/Kaltura.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,32 @@ export default class Kaltura extends Component {
if (!this.iframe) return
this.player = new playerjs.Player(this.iframe)
this.player.on('ready', () => {
this.player.isReady = true
this.player.on('play', this.props.onPlay)
this.player.on('pause', this.props.onPause)
this.player.on('seeked', this.props.onSeek)
this.player.on('ended', this.props.onEnded)
this.player.on('error', this.props.onError)
this.player.on('timeupdate', ({ duration, seconds }) => {
this.duration = duration
this.currentTime = seconds
})
this.player.on('buffered', ({ percent }) => {
if (this.duration) {
this.secondsLoaded = this.duration * percent
}
})
this.player.setLoop(this.props.loop)
if (this.props.muted) {
this.player.mute()
}
// An arbitrary timeout is required otherwise
// the event listeners won’t work
setTimeout(() => {
this.player.isReady = true
this.player.setLoop(this.props.loop)
if (this.props.muted) {
this.player.mute()
}
this.addListeners(this.player, this.props)
this.props.onReady()
})
}, 500)
})
}, this.props.onError)
}

addListeners (player, props) {
player.on('play', props.onPlay)
player.on('pause', props.onPause)
player.on('ended', props.onEnded)
player.on('error', props.onError)
player.on('timeupdate', ({ duration, seconds }) => {
this.duration = duration
this.currentTime = seconds
})
}

play () {
this.callPlayer('play')
}
Expand Down Expand Up @@ -110,7 +110,7 @@ export default class Kaltura extends Component {
scrolling='no'
style={style}
allowFullScreen
allow='encrypted-media'
allow='encrypted-media;autoplay'
referrerPolicy='no-referrer-when-downgrade'
/>
)
Expand Down