uniapp 视频播放
时间: 2023-09-06 07:08:28 浏览: 129
在uniapp中,可以使用即构的uniapp实时音视频SDK提供的媒体播放器组件来实现视频播放功能。 首先,需要在页面中使用`<zego-mediaplayer-view>`标签,并调用`setPlayerView`接口来设置视频的显示视图。示例代码如下:
```html
<template>
<zego-mediaplayer-view :playerID="playerID" style="height: 260.38rpx"></zego-mediaplayer-view>
</template>
<script>
import { ZegoExpressEngine } from 'zego-express-engine';
export default {
data() {
return {
playerID: null,
};
},
async mounted() {
let mediaPlayer = await ZegoExpressEngine.instance().createMediaPlayer();
this.playerID = mediaPlayer.getIndex();
mediaPlayer.setPlayerView(this.playerID);
},
};
</script>
```
在以上示例中,我们通过`ZegoExpressEngine.instance().createMediaPlayer<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [uniapp音视频播放功能实现](https://blog.csdn.net/Lucky_wu24/article/details/131133378)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文