-
Notifications
You must be signed in to change notification settings - Fork 5
/
AliyunPlayerView.js
48 lines (40 loc) · 1.15 KB
/
AliyunPlayerView.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Created by react-native-create-bridge
import React, {Component} from 'react'
import {requireNativeComponent, NativeModules} from 'react-native'
const AliyunPlayer = requireNativeComponent('AliyunPlay', AliyunPlayView)
const {AliyunPlayManager} = NativeModules
export default class AliyunPlayView extends Component {
/**
* 功能:停止播放视频
*/
stop = () => {
AliyunPlayManager.stop()
}
/**
* 功能:暂停播放视频
* 备注:在start播放视频之后可以调用pause进行暂停。
*/
pause = () => {
AliyunPlayManager.pause()
}
/**
* 功能:恢复播放视频
* 备注:在pause暂停视频之后可以调用resume进行播放。
*/
resume = () => {
AliyunPlayManager.resume()
}
/**
* 功能:跳转到指定位置进行播放,单位为秒
* @param time
*/
seekToTime = (time) => {
AliyunPlayManager.seekToTime(time)
}
render() {
return <AliyunPlayer ref={ref => this.aliyunPlay = ref}{...this.props} />
}
}
// AliyunPlayView.propTypes = {
// exampleProp: React.PropTypes.any
// }