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 个评论
要回复文章请先登录或注册