huayu
huayu
  • 发布:2021-04-04 09:42
  • 更新:2026-03-25 09:23
  • 阅读:2328

live-pusher

分类:uni-app

this.liveContext = uni.createLivePusherContext('livePusher', this); 直接是没有此方法,用的nvue

<template> <view> <live-pusher id="livePusher" ref="livePusher" class="livePusher" url="livePushUrl" mode="SD" muted="true" enable-camera="true" auto-focus="true"

beauty="1" whiteness="2"
aspect="9:16"
@statechange="statechange"
@netstatus="netstatus"
@error="error"

</live-pusher>
<button class="btn" @click="start">开始推流</button>
<button class="btn" @click="pause">暂停推流</button>
<button class="btn" @click="resume">resume</button>
<button class="btn" @click="stop">停止推流</button>
<button class="btn" @click="snapshot">快照</button>
<button class="btn" @click="startPreview">开启摄像头预览</button>
<button class="btn" @click="stopPreview">关闭摄像头预览</button>
<button class="btn" @click="switchCamera">切换摄像头</button>

        <view>  
            <video :src="livePushUrl" style="width: 100%;height: 400rpx;" :autoplay="true" controls></video>  
        </view>  

</view>
</template>

0 关注 分享

要回复文章请先登录注册

忙碌的小蚂蚁

忙碌的小蚂蚁

我使用nvue开发<live-pusher>主播推流,正常。推流demo可以参考:/pages/video/push_app2.nvue
直播系统可以到Gitee 代码仓库免费下载:
https://gitee.com/mldxmy/simplelive
2026-03-25 09:23