mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-13 07:56:23 +00:00
feat: added loop button to video.js player
This commit is contained in:
parent
7d2e2d97e0
commit
b2a11ae42c
@ -18,6 +18,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.vjs-loop-button,
|
||||
.vjs-seek-button {
|
||||
.vjs-icon-placeholder {
|
||||
/* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
|
||||
@ -33,6 +34,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
.vjs-loop-button {
|
||||
&:not(.vjs-loop-enabled) {
|
||||
color: $grey
|
||||
}
|
||||
|
||||
.vjs-icon-placeholder::before {
|
||||
content: "\e81f"
|
||||
}
|
||||
}
|
||||
|
||||
.vjs-seek-button {
|
||||
&.skip-back .vjs-icon-placeholder::before {
|
||||
content: "\e81e";
|
||||
|
@ -128,6 +128,25 @@ page.reloadVideo = () => {
|
||||
})
|
||||
page.player.seekButtons({ forward: 10, back: 10 })
|
||||
|
||||
const videoJSButton = videojs.getComponent('Button')
|
||||
const loopButtonText = () => page.player.loop()
|
||||
? 'Disable loop'
|
||||
: 'Enable loop'
|
||||
const loopButton = videojs.extend(videoJSButton, {
|
||||
constructor () {
|
||||
videoJSButton.apply(this, arguments)
|
||||
this.addClass('vjs-loop-button')
|
||||
this.controlText(loopButtonText())
|
||||
},
|
||||
handleClick () {
|
||||
page.player.loop(!page.player.loop())
|
||||
this.toggleClass('vjs-loop-enabled', page.player.loop())
|
||||
this.controlText(loopButtonText())
|
||||
}
|
||||
})
|
||||
videojs.registerComponent('loopButton', loopButton)
|
||||
page.player.getChild('controlBar').addChild('loopButton')
|
||||
|
||||
if (page.titleFormat) {
|
||||
document.title = page.titleFormat.replace(/%identifier%/g, page.urlIdentifier)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user