video
This commit is contained in:
78
pages/index/index.nvue
Normal file
78
pages/index/index.nvue
Normal file
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<view>
|
||||
<zhimi_aliplayer_view ref="playerView" style="width:100%;height:300px;"></zhimi_aliplayer_view>
|
||||
<button type="primary" @click="start()">开始</button>
|
||||
<button type="primary" @click="pause()">暂停</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
},
|
||||
onShow () {
|
||||
|
||||
},
|
||||
onHide () {
|
||||
this.pause()
|
||||
},
|
||||
mounted() {
|
||||
var playerView = this.$refs.playerView;
|
||||
|
||||
|
||||
playerView.setVidSts({
|
||||
"vid": "d0c8e6d23e5f71ef81714531858c0102",
|
||||
"accessKeyId": "STS.NTGWXhnCVxeiE3jv2FPkaconD",
|
||||
"securityToken": "CAISwgJ1q6Ft5B2yfSjIr5fyHOLcg5x3z6eCRxXbkjITXORNjKrFpjz2IHhMdHFuB+4YsP41lWtS7f8alqJvRoRZXkHfdsp36MzvQMIQgNCT1fau5Jko1beDewHKeT+ZsebWZ+LmNqS/Ht6md1HDkAJq3LL+bk/Mdle5MJqP+/EFA8oQUlv6F00kYu1bPQx/ssQXGGLMPPK2SH7Qj3HXEVBjt3gX6wo9y9zmnJXAtUaG1Qalmr5M9tyuGPX+MZkwZqUYesyuwel7epDG1CNt8BVQ/M909vccoWef4I/DXQcLuUTdabGNqscAMgh1fK8+Fr7vNBB7d2X80Aa6tfMUq34lVYk9O0xUlBgvRFbCU6ovuoKM/1JX7+gpfvTOV/+7+kpvCikgLwgpMPFKCRxrQicnUVK3ROLZvj6DDGitI72BtpVoufIdGoABffDnFykDKsxFFQZwKGrrVUFPL1V48K4ovYkHx15iw2mW6RqNrJDDSl56UfTxDcaRSk0HqA8+e+1pO3LW2vMRHrIhIqhu3gCbbCBATVb8v96Y5HIXIIw29gX9o0xfMgFIdHTZ+YsMSjacnXpvmslLzRD7vNiVgC2E6ySVcvzQOG0gAA==",
|
||||
"accessKeySecret": "GcyVng2e6UBbmbKiEN1ArqFqy3uGSAg8dsc8N1Pajm2V",
|
||||
"expireTime": "2024-07-16T10:50:38Z",
|
||||
"Region": "cn-shanghai",
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
let isFullScreen = true;
|
||||
// fixed fullscreen play on android
|
||||
if (plus.os.name.toLowerCase() === 'android') {
|
||||
plus.key.addEventListener('backbutton', e => {
|
||||
if (isFullScreen) {
|
||||
playerView.changeScreenMode(0, false)
|
||||
isFullScreen = false
|
||||
} else {
|
||||
// 这里由于安卓无法监听返回按键,这里只能通过plus监听,然后自己模拟退回
|
||||
uni.navigateBack()
|
||||
}
|
||||
});
|
||||
}
|
||||
playerView.setPlayerCallBack(({ type, data }) => {
|
||||
switch (type) {
|
||||
case 'isFullScreen':
|
||||
isFullScreen = Boolean(data)
|
||||
break
|
||||
default:
|
||||
console.log({ type, data })
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
start() {
|
||||
var playerView = this.$refs.playerView;
|
||||
playerView.start();
|
||||
},
|
||||
pause() {
|
||||
var playerView = this.$refs.playerView;
|
||||
playerView.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user