You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.0 KiB
43 lines
1.0 KiB
|
3 years ago
|
import {
|
||
|
|
findElmById,
|
||
|
|
invokeVmMethod,
|
||
|
|
invokeVmMethodWithoutArgs
|
||
|
|
} from '../util'
|
||
|
|
|
||
|
|
const METHODS = {
|
||
|
|
play (ctx) {
|
||
|
|
return invokeVmMethodWithoutArgs(ctx, 'play')
|
||
|
|
},
|
||
|
|
pause (ctx) {
|
||
|
|
return invokeVmMethodWithoutArgs(ctx, 'pause')
|
||
|
|
},
|
||
|
|
seek (ctx, args) {
|
||
|
|
return invokeVmMethod(ctx, 'seek', args.position)
|
||
|
|
},
|
||
|
|
stop (ctx) {
|
||
|
|
return invokeVmMethodWithoutArgs(ctx, 'stop')
|
||
|
|
},
|
||
|
|
sendDanmu (ctx, args) {
|
||
|
|
return invokeVmMethod(ctx, 'sendDanmu', args)
|
||
|
|
},
|
||
|
|
playbackRate (ctx, args) {
|
||
|
|
return invokeVmMethod(ctx, 'playbackRate', args.rate)
|
||
|
|
},
|
||
|
|
requestFullScreen (ctx, args) {
|
||
|
|
return invokeVmMethod(ctx, 'requestFullScreen', args)
|
||
|
|
},
|
||
|
|
exitFullScreen (ctx) {
|
||
|
|
return invokeVmMethodWithoutArgs(ctx, 'exitFullScreen')
|
||
|
|
},
|
||
|
|
showStatusBar (ctx) {
|
||
|
|
return invokeVmMethodWithoutArgs(ctx, 'showStatusBar')
|
||
|
|
},
|
||
|
|
hideStatusBar (ctx) {
|
||
|
|
return invokeVmMethodWithoutArgs(ctx, 'hideStatusBar')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export function operateVideoPlayer (videoId, pageVm, type, data) {
|
||
|
|
return METHODS[type](findElmById(videoId, pageVm), data)
|
||
|
|
}
|