智能照明系统APP-本地串口
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.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/88/88d89e33f810181cd3888273227...

71 lines
1.4 KiB

import {
invokeMethod,
getCurrentPageVm
} from '../../platform'
const RATES = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0]
function operateVideoPlayer (videoId, pageVm, type, data) {
invokeMethod('operateVideoPlayer', videoId, pageVm, type, data)
}
export class VideoContext {
constructor (id, pageVm) {
this.id = id
this.pageVm = pageVm
}
play () {
operateVideoPlayer(this.id, this.pageVm, 'play')
}
pause () {
operateVideoPlayer(this.id, this.pageVm, 'pause')
}
stop () {
operateVideoPlayer(this.id, this.pageVm, 'stop')
}
seek (position) {
operateVideoPlayer(this.id, this.pageVm, 'seek', {
position
})
}
sendDanmu (args) {
operateVideoPlayer(this.id, this.pageVm, 'sendDanmu', args)
}
playbackRate (rate) {
if (!~RATES.indexOf(rate)) {
rate = 1.0
}
operateVideoPlayer(this.id, this.pageVm, 'playbackRate', {
rate
})
}
requestFullScreen (args = {}) {
operateVideoPlayer(this.id, this.pageVm, 'requestFullScreen', args)
}
exitFullScreen () {
operateVideoPlayer(this.id, this.pageVm, 'exitFullScreen')
}
showStatusBar () {
operateVideoPlayer(this.id, this.pageVm, 'showStatusBar')
}
hideStatusBar () {
operateVideoPlayer(this.id, this.pageVm, 'hideStatusBar')
}
}
export function createVideoContext (id, context) {
if (context) {
return new VideoContext(id, context)
}
return new VideoContext(id, getCurrentPageVm('createVideoContext'))
}