Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
20岁爱吃必胜客
uni-app
提交
0c627102
U
uni-app
项目概览
20岁爱吃必胜客
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0c627102
编写于
10月 26, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(v3): createVideoContext
上级
efa1fd3d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
231 addition
and
225 deletion
+231
-225
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+107
-90
src/core/service/api/context/create-video-context.js
src/core/service/api/context/create-video-context.js
+62
-0
src/platforms/app-plus-nvue/service/api/context/operate-video-player.js
...app-plus-nvue/service/api/context/operate-video-player.js
+42
-0
src/platforms/app-plus-nvue/service/api/context/video.js
src/platforms/app-plus-nvue/service/api/context/video.js
+0
-63
src/platforms/app-plus/service/api/context/operate-video-player.js
...orms/app-plus/service/api/context/operate-video-player.js
+12
-0
src/platforms/h5/service/api/context/operate-video-player.js
src/platforms/h5/service/api/context/operate-video-player.js
+8
-0
src/platforms/h5/service/api/context/video.js
src/platforms/h5/service/api/context/video.js
+0
-72
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
0c627102
...
...
@@ -7757,74 +7757,28 @@ var serviceContext = (function () {
this
.
pageVm
=
pageVm
;
}
getCenterLocation
({
success
,
fail
,
complete
})
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
getCenterLocation
'
,
{
success
,
fail
,
complete
});
getCenterLocation
(
args
)
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
getCenterLocation
'
,
args
);
}
moveToLocation
()
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
moveToLocation
'
);
}
translateMarker
({
markerId
,
destination
,
autoRotate
,
rotate
,
duration
,
animationEnd
,
fail
})
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
translateMarker
'
,
{
markerId
,
destination
,
autoRotate
,
rotate
,
duration
,
animationEnd
,
fail
});
translateMarker
(
args
)
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
translateMarker
'
,
args
);
}
includePoints
({
points
,
padding
})
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
includePoints
'
,
{
points
,
padding
});
includePoints
(
args
)
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
includePoints
'
,
args
);
}
getRegion
({
success
,
fail
,
complete
})
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
getRegion
'
,
{
success
,
fail
,
complete
});
getRegion
(
args
)
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
getRegion
'
,
args
);
}
getScale
({
success
,
fail
,
complete
})
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
getScale
'
,
{
success
,
fail
,
complete
});
getScale
(
args
)
{
operateMapPlayer
(
this
.
id
,
this
.
pageVm
,
'
getScale
'
,
args
);
}
}
...
...
@@ -7839,6 +7793,68 @@ var serviceContext = (function () {
createMapContext
:
createMapContext$1
});
const
RATES
=
[
0.5
,
0.8
,
1.0
,
1.25
,
1.5
];
function
operateVideoPlayer
(
videoId
,
pageVm
,
type
,
data
)
{
invokeMethod
(
'
operateVideoPlayer
'
,
videoId
,
pageVm
,
type
,
data
);
}
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
()
{
operateVideoPlayer
(
this
.
id
,
this
.
pageVm
,
'
requestFullScreen
'
);
}
exitFullScreen
()
{
operateVideoPlayer
(
this
.
id
,
this
.
pageVm
,
'
exitFullScreen
'
);
}
showStatusBar
()
{
operateVideoPlayer
(
this
.
id
,
this
.
pageVm
,
'
showStatusBar
'
);
}
hideStatusBar
()
{
operateVideoPlayer
(
this
.
id
,
this
.
pageVm
,
'
hideStatusBar
'
);
}
}
function
createVideoContext$1
(
id
,
context
)
{
if
(
context
)
{
return
new
VideoContext
(
id
,
context
)
}
return
new
VideoContext
(
id
,
getCurrentPageVm
(
'
createVideoContext
'
))
}
var
require_context_module_1_7
=
/*#__PURE__*/
Object
.
freeze
({
createVideoContext
:
createVideoContext$1
});
const
callbacks$3
=
[];
onMethod
(
'
onAccelerometerChange
'
,
function
(
res
)
{
...
...
@@ -7879,7 +7895,7 @@ var serviceContext = (function () {
})
}
var
require_context_module_1_
7
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_
8
=
/*#__PURE__*/
Object
.
freeze
({
onAccelerometerChange
:
onAccelerometerChange
,
startAccelerometer
:
startAccelerometer
,
stopAccelerometer
:
stopAccelerometer
...
...
@@ -7902,7 +7918,7 @@ var serviceContext = (function () {
const
onBLEConnectionStateChange$1
=
on
(
'
onBLEConnectionStateChange
'
);
const
onBLECharacteristicValueChange$1
=
on
(
'
onBLECharacteristicValueChange
'
);
var
require_context_module_1_
8
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_
9
=
/*#__PURE__*/
Object
.
freeze
({
onBluetoothDeviceFound
:
onBluetoothDeviceFound$1
,
onBluetoothAdapterStateChange
:
onBluetoothAdapterStateChange$1
,
onBLEConnectionStateChange
:
onBLEConnectionStateChange$1
,
...
...
@@ -7949,7 +7965,7 @@ var serviceContext = (function () {
})
}
var
require_context_module_1_
9
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_
10
=
/*#__PURE__*/
Object
.
freeze
({
onCompassChange
:
onCompassChange
,
startCompass
:
startCompass
,
stopCompass
:
stopCompass
...
...
@@ -7967,7 +7983,7 @@ var serviceContext = (function () {
callbacks$5
.
push
(
callbackId
);
}
var
require_context_module_1_1
0
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
1
=
/*#__PURE__*/
Object
.
freeze
({
onNetworkStatusChange
:
onNetworkStatusChange
});
...
...
@@ -8044,7 +8060,7 @@ var serviceContext = (function () {
return
recorderManager
||
(
recorderManager
=
new
RecorderManager
())
}
var
require_context_module_1_1
1
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
2
=
/*#__PURE__*/
Object
.
freeze
({
getRecorderManager
:
getRecorderManager
});
...
...
@@ -8132,7 +8148,7 @@ var serviceContext = (function () {
return
task
}
var
require_context_module_1_1
2
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
3
=
/*#__PURE__*/
Object
.
freeze
({
downloadFile
:
downloadFile$1
});
...
...
@@ -8237,7 +8253,7 @@ var serviceContext = (function () {
return
new
RequestTask
(
requestTaskId
)
}
var
require_context_module_1_1
3
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
4
=
/*#__PURE__*/
Object
.
freeze
({
request
:
request$1
});
...
...
@@ -8411,7 +8427,7 @@ var serviceContext = (function () {
callbacks$7
.
close
=
callbackId
;
}
var
require_context_module_1_1
4
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
5
=
/*#__PURE__*/
Object
.
freeze
({
connectSocket
:
connectSocket$1
,
sendSocketMessage
:
sendSocketMessage$1
,
closeSocket
:
closeSocket$1
,
...
...
@@ -8505,7 +8521,7 @@ var serviceContext = (function () {
return
task
}
var
require_context_module_1_1
5
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
6
=
/*#__PURE__*/
Object
.
freeze
({
uploadFile
:
uploadFile$1
});
...
...
@@ -8614,7 +8630,7 @@ var serviceContext = (function () {
return
res
}
var
require_context_module_1_1
6
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
7
=
/*#__PURE__*/
Object
.
freeze
({
setStorage
:
setStorage$1
,
setStorageSync
:
setStorageSync$1
,
getStorage
:
getStorage$1
,
...
...
@@ -8705,7 +8721,7 @@ var serviceContext = (function () {
return
new
MPAnimation
(
option
)
}
var
require_context_module_1_1
7
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
8
=
/*#__PURE__*/
Object
.
freeze
({
createAnimation
:
createAnimation
});
...
...
@@ -8769,7 +8785,7 @@ var serviceContext = (function () {
return
new
ServiceIntersectionObserver
(
getCurrentPageVm
(
'
createIntersectionObserver
'
),
options
)
}
var
require_context_module_1_1
8
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_1
9
=
/*#__PURE__*/
Object
.
freeze
({
createIntersectionObserver
:
createIntersectionObserver
});
...
...
@@ -8877,7 +8893,7 @@ var serviceContext = (function () {
return
new
SelectorQuery
(
getCurrentPageVm
(
'
createSelectorQuery
'
))
}
var
require_context_module_1_
19
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_
20
=
/*#__PURE__*/
Object
.
freeze
({
createSelectorQuery
:
createSelectorQuery
});
...
...
@@ -8893,7 +8909,7 @@ var serviceContext = (function () {
callbacks$8
.
push
(
callbackId
);
}
var
require_context_module_1_2
0
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
1
=
/*#__PURE__*/
Object
.
freeze
({
onKeyboardHeightChange
:
onKeyboardHeightChange
});
...
...
@@ -8905,7 +8921,7 @@ var serviceContext = (function () {
return
{}
}
var
require_context_module_1_2
1
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
2
=
/*#__PURE__*/
Object
.
freeze
({
pageScrollTo
:
pageScrollTo$1
});
...
...
@@ -8941,7 +8957,7 @@ var serviceContext = (function () {
callbacks$9
.
push
(
callbackId
);
}
var
require_context_module_1_2
2
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
3
=
/*#__PURE__*/
Object
.
freeze
({
removeTabBarBadge
:
removeTabBarBadge$1
,
showTabBarRedDot
:
showTabBarRedDot$1
,
hideTabBarRedDot
:
hideTabBarRedDot$1
,
...
...
@@ -8964,7 +8980,7 @@ var serviceContext = (function () {
callbacks$a
.
splice
(
callbacks$a
.
indexOf
(
callbackId
),
1
);
}
var
require_context_module_1_2
3
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
4
=
/*#__PURE__*/
Object
.
freeze
({
onWindowResize
:
onWindowResize
,
offWindowResize
:
offWindowResize
});
...
...
@@ -8981,23 +8997,24 @@ var serviceContext = (function () {
'
./context/audio.js
'
:
require_context_module_1_4
,
'
./context/background-audio.js
'
:
require_context_module_1_5
,
'
./context/create-map-context.js
'
:
require_context_module_1_6
,
'
./device/accelerometer.js
'
:
require_context_module_1_7
,
'
./device/bluetooth.js
'
:
require_context_module_1_8
,
'
./device/compass.js
'
:
require_context_module_1_9
,
'
./device/network.js
'
:
require_context_module_1_10
,
'
./media/recorder.js
'
:
require_context_module_1_11
,
'
./network/download-file.js
'
:
require_context_module_1_12
,
'
./network/request.js
'
:
require_context_module_1_13
,
'
./network/socket.js
'
:
require_context_module_1_14
,
'
./network/upload-file.js
'
:
require_context_module_1_15
,
'
./storage/storage.js
'
:
require_context_module_1_16
,
'
./ui/create-animation.js
'
:
require_context_module_1_17
,
'
./ui/create-intersection-observer.js
'
:
require_context_module_1_18
,
'
./ui/create-selector-query.js
'
:
require_context_module_1_19
,
'
./ui/keyboard.js
'
:
require_context_module_1_20
,
'
./ui/page-scroll-to.js
'
:
require_context_module_1_21
,
'
./ui/tab-bar.js
'
:
require_context_module_1_22
,
'
./ui/window.js
'
:
require_context_module_1_23
,
'
./context/create-video-context.js
'
:
require_context_module_1_7
,
'
./device/accelerometer.js
'
:
require_context_module_1_8
,
'
./device/bluetooth.js
'
:
require_context_module_1_9
,
'
./device/compass.js
'
:
require_context_module_1_10
,
'
./device/network.js
'
:
require_context_module_1_11
,
'
./media/recorder.js
'
:
require_context_module_1_12
,
'
./network/download-file.js
'
:
require_context_module_1_13
,
'
./network/request.js
'
:
require_context_module_1_14
,
'
./network/socket.js
'
:
require_context_module_1_15
,
'
./network/upload-file.js
'
:
require_context_module_1_16
,
'
./storage/storage.js
'
:
require_context_module_1_17
,
'
./ui/create-animation.js
'
:
require_context_module_1_18
,
'
./ui/create-intersection-observer.js
'
:
require_context_module_1_19
,
'
./ui/create-selector-query.js
'
:
require_context_module_1_20
,
'
./ui/keyboard.js
'
:
require_context_module_1_21
,
'
./ui/page-scroll-to.js
'
:
require_context_module_1_22
,
'
./ui/tab-bar.js
'
:
require_context_module_1_23
,
'
./ui/window.js
'
:
require_context_module_1_24
,
};
var
req
=
function
req
(
key
)
{
...
...
src/core/service/api/context/create-video-context.js
0 → 100644
浏览文件 @
0c627102
import
{
invokeMethod
,
getCurrentPageVm
}
from
'
../../platform
'
const
RATES
=
[
0.5
,
0.8
,
1.0
,
1.25
,
1.5
]
function
operateVideoPlayer
(
videoId
,
pageVm
,
type
,
data
)
{
invokeMethod
(
'
operateVideoPlayer
'
,
videoId
,
pageVm
,
type
,
data
)
}
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
()
{
operateVideoPlayer
(
this
.
id
,
this
.
pageVm
,
'
requestFullScreen
'
)
}
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
'
))
}
src/platforms/app-plus-nvue/service/api/context/operate-video-player.js
0 → 100644
浏览文件 @
0c627102
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
)
},
stop
(
ctx
)
{
return
invokeVmMethodWithoutArgs
(
ctx
,
'
stop
'
)
},
sendDanmu
(
ctx
,
args
)
{
return
invokeVmMethod
(
ctx
,
'
sendDanmu
'
,
args
)
},
playbackRate
(
ctx
,
args
)
{
return
invokeVmMethod
(
ctx
,
'
playbackRate
'
,
args
)
},
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
)
}
src/platforms/app-plus-nvue/service/api/context/video.js
已删除
100644 → 0
浏览文件 @
efa1fd3d
import
{
findElmById
,
invokeVmMethod
,
invokeVmMethodWithoutArgs
}
from
'
../util
'
class
VideoContext
{
constructor
(
id
,
ctx
)
{
this
.
id
=
id
this
.
ctx
=
ctx
}
play
()
{
return
invokeVmMethodWithoutArgs
(
this
.
ctx
,
'
play
'
)
}
pause
()
{
return
invokeVmMethodWithoutArgs
(
this
.
ctx
,
'
pause
'
)
}
seek
(
args
)
{
return
invokeVmMethod
(
this
.
ctx
,
'
seek
'
,
args
)
}
stop
()
{
return
invokeVmMethodWithoutArgs
(
this
.
ctx
,
'
stop
'
)
}
sendDanmu
(
args
)
{
return
invokeVmMethod
(
this
.
ctx
,
'
sendDanmu
'
,
args
)
}
playbackRate
(
args
)
{
return
invokeVmMethod
(
this
.
ctx
,
'
playbackRate
'
,
args
)
}
requestFullScreen
(
args
)
{
return
invokeVmMethod
(
this
.
ctx
,
'
requestFullScreen
'
,
args
)
}
exitFullScreen
()
{
return
invokeVmMethodWithoutArgs
(
this
.
ctx
,
'
exitFullScreen
'
)
}
showStatusBar
()
{
return
invokeVmMethodWithoutArgs
(
this
.
ctx
,
'
showStatusBar
'
)
}
hideStatusBar
()
{
return
invokeVmMethodWithoutArgs
(
this
.
ctx
,
'
hideStatusBar
'
)
}
}
export
function
createVideoContext
(
id
,
vm
)
{
if
(
!
vm
)
{
return
console
.
warn
(
'
uni.createVideoContext 必须传入第二个参数,即当前 vm 对象(this)
'
)
}
const
elm
=
findElmById
(
id
,
vm
)
if
(
!
elm
)
{
return
console
.
warn
(
'
Can not find `
'
+
id
+
'
`
'
)
}
return
new
VideoContext
(
id
,
elm
)
}
src/platforms/app-plus/service/api/context/operate-video-player.js
0 → 100644
浏览文件 @
0c627102
import
{
operateVideoPlayer
as
operateVueVideoPlayer
}
from
'
uni-platforms/h5/service/api/context/operate-video-player
'
import
{
operateVideoPlayer
as
operateNVueVideoPlayer
}
from
'
uni-platforms/app-plus-nvue/service/api/context/operate-video-player
'
export
function
operateVideoPlayer
(
videoId
,
pageVm
,
type
,
data
)
{
pageVm
.
$page
.
meta
.
isNVue
?
operateNVueVideoPlayer
(
videoId
,
pageVm
,
type
,
data
)
:
operateVueVideoPlayer
(
videoId
,
pageVm
,
type
,
data
)
}
src/platforms/h5/service/api/context/operate-video-player.js
0 → 100644
浏览文件 @
0c627102
export
function
operateVideoPlayer
(
videoId
,
pageVm
,
type
,
data
)
{
const
pageId
=
pageVm
.
$page
.
id
UniServiceJSBridge
.
publishHandler
(
pageId
+
'
-video-
'
+
videoId
,
{
videoId
,
type
,
data
},
pageId
)
}
src/platforms/h5/service/api/context/video.js
已删除
100644 → 0
浏览文件 @
efa1fd3d
function
operateVideoPlayer
(
videoId
,
pageId
,
type
,
data
)
{
UniServiceJSBridge
.
publishHandler
(
pageId
+
'
-video-
'
+
videoId
,
{
videoId
,
type
,
data
},
pageId
)
}
const
RATES
=
[
0.5
,
0.8
,
1.0
,
1.25
,
1.5
]
class
VideoContext
{
constructor
(
id
,
pageId
)
{
this
.
id
=
id
this
.
pageId
=
pageId
}
play
()
{
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
play
'
)
}
pause
()
{
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
pause
'
)
}
stop
()
{
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
stop
'
)
}
seek
(
position
)
{
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
seek
'
,
{
position
})
}
sendDanmu
({
text
,
color
}
=
{})
{
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
sendDanmu
'
,
{
text
,
color
})
}
playbackRate
(
rate
)
{
if
(
!~
RATES
.
indexOf
(
rate
))
{
rate
=
1.0
}
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
playbackRate
'
,
{
rate
})
}
requestFullScreen
()
{
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
requestFullScreen
'
)
}
exitFullScreen
()
{
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
exitFullScreen
'
)
}
showStatusBar
()
{
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
showStatusBar
'
)
}
hideStatusBar
()
{
operateVideoPlayer
(
this
.
id
,
this
.
pageId
,
'
hideStatusBar
'
)
}
}
export
function
createVideoContext
(
id
,
context
)
{
if
(
context
)
{
return
new
VideoContext
(
id
,
context
.
$page
.
id
)
}
const
app
=
getApp
()
if
(
app
.
$route
&&
app
.
$route
.
params
.
__id__
)
{
return
new
VideoContext
(
id
,
app
.
$route
.
params
.
__id__
)
}
else
{
UniServiceJSBridge
.
emit
(
'
onError
'
,
'
createVideoContext:fail
'
)
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录