直播调试
parent
d465df1aca
commit
2ea23fe662
|
|
@ -9,6 +9,11 @@
|
|||
"usingComponents" : true,
|
||||
"nvueCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"safearea": {
|
||||
"bottom": {
|
||||
"offset": "none"
|
||||
}
|
||||
},
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
|
|
@ -187,18 +192,19 @@
|
|||
}
|
||||
},
|
||||
"__usePrivacyCheck__" : true,
|
||||
"plugins" : {}
|
||||
"plugins" : {
|
||||
// 腾讯地图路线规划插件(需要到小程序后台设置->第三方设置->插件管理里面添加【腾讯位置服务路线规划】插件,教程 https://mp.weixin.qq.com/wxopen/plugindevdoc?appid=wx50b5593e81dd937a)
|
||||
// "routePlan" : {
|
||||
// "version" : "1.0.19",
|
||||
// "provider" : "wx50b5593e81dd937a"
|
||||
// },
|
||||
// 直播(需要到小程序后台设置->第三方设置->插件管理里面添加【小程序直播组件】插件,教程 https://mp.weixin.qq.com/wxopen/pluginbasicprofile?action=intro&appid=wx2b03c6e691cd7370)
|
||||
// "live-player-plugin" : {
|
||||
// "version" : "1.3.5",
|
||||
// "provider" : "wx2b03c6e691cd7370"
|
||||
// }
|
||||
}
|
||||
},
|
||||
// 腾讯地图路线规划插件(需要到小程序后台设置->第三方设置->插件管理里面添加【腾讯位置服务路线规划】插件,教程 https://mp.weixin.qq.com/wxopen/plugindevdoc?appid=wx50b5593e81dd937a)
|
||||
// "routePlan" : {
|
||||
// "version" : "1.0.19",
|
||||
// "provider" : "wx50b5593e81dd937a"
|
||||
// },
|
||||
// 直播(需要到小程序后台设置->第三方设置->插件管理里面添加【小程序直播组件】插件,教程 https://mp.weixin.qq.com/wxopen/pluginbasicprofile?action=intro&appid=wx2b03c6e691cd7370)
|
||||
// "live-player-plugin" : {
|
||||
// "version" : "1.3.5",
|
||||
// "provider" : "wx2b03c6e691cd7370"
|
||||
// }
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true,
|
||||
"appid" : "2021001173639600"
|
||||
|
|
|
|||
18
pages.json
18
pages.json
|
|
@ -2121,8 +2121,15 @@
|
|||
"transparentTitle": "auto",
|
||||
"titlePenetrate": "YES",
|
||||
// #endif
|
||||
"disableScroll": true,
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationBarTitleText": ""
|
||||
"navigationBarTitleText": "",
|
||||
"app-plus": {
|
||||
"bounce": {
|
||||
"top": "none",
|
||||
"bottom": "none"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -2135,8 +2142,15 @@
|
|||
"transparentTitle": "auto",
|
||||
"titlePenetrate": "YES",
|
||||
// #endif
|
||||
"disableScroll": true,
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationBarTitleText": ""
|
||||
"navigationBarTitleText": "",
|
||||
"app-plus": {
|
||||
"bounce": {
|
||||
"top": "none",
|
||||
"bottom": "none"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -289,6 +289,14 @@
|
|||
<!-- 公共 -->
|
||||
<component-common ref="common" :propIsGrayscale="plugins_mourning_data_is_app"></component-common>
|
||||
</block>
|
||||
|
||||
|
||||
<!-- <view class="margin-top-xxxxl padding-top-xxxxl padding-bottom-xxxxl tc">
|
||||
<navigator data-value="/pages/plugins/live/push/push" @tap="url_event">推流</navigator>
|
||||
<view class="margin-top-lg">
|
||||
<navigator data-value="/pages/plugins/live/pull/pull" @tap="url_event">拉流</navigator>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -1,33 +1,39 @@
|
|||
<template>
|
||||
<view>
|
||||
<live-player
|
||||
src="rtmp://live-pull.shopxo.vip/68f764013572f9240ca7ce6c/shopxo"
|
||||
mode="live"
|
||||
autoplay
|
||||
@statechange="statechange"
|
||||
@error="error"
|
||||
style="width: 400px; height: 525px;"
|
||||
/>
|
||||
<view :class="theme_view">
|
||||
<video class="wh-auto ht dis-block" :is-live="true" src="rtmp://live-pull.shopxo.vip/68f764013572f9240ca7ce6c/shopxo"
|
||||
@error="video_error_callback"
|
||||
:autoplay="autoplay"
|
||||
:controls="controls"
|
||||
:show-fullscreen-btn="show_fullscreen_btn"
|
||||
:enable-play-gesture="false"
|
||||
></video>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
statechange(e){
|
||||
console.log('live-player code:', e.detail.code)
|
||||
const app = getApp();
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
// 自动播放
|
||||
autoplay: true,
|
||||
// 控制
|
||||
controls: false,
|
||||
// 全屏按钮
|
||||
show_fullscreen_btn: false,
|
||||
}
|
||||
},
|
||||
error(e){
|
||||
console.error('live-player error:', e.detail.errMsg)
|
||||
methods: {
|
||||
// 播放错误回调
|
||||
video_error_callback: function(e) {
|
||||
uni.showModal({
|
||||
content: e.target.errMsg,
|
||||
showCancel: false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
|
@ -1,37 +1,51 @@
|
|||
<template>
|
||||
<view>
|
||||
<live-pusher id='livePusher' ref="livePusher" class="livePusher" url="rtmp://live-push.shopxo.vip/68f764013572f9240ca7ce6c/shopxo"
|
||||
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
|
||||
id='livePusher'
|
||||
ref="livePusher"
|
||||
class="livePusher"
|
||||
:url="url"
|
||||
mode="SD"
|
||||
:muted="false"
|
||||
:enable-camera="true"
|
||||
:auto-focus="true"
|
||||
:beauty="1"
|
||||
whiteness="2"
|
||||
aspect="9:16"
|
||||
@statechange="statechange"
|
||||
@netstatus="netstatus"
|
||||
@error = "error"
|
||||
style="width: 100%;height: 500px;"
|
||||
></live-pusher>
|
||||
<view class="margin-top-xxxxl padding-top-xxxxl">
|
||||
<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>
|
||||
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
context: null
|
||||
}
|
||||
},
|
||||
onReady() {
|
||||
// 注意:需要在onReady中 或 onLoad 延时
|
||||
context: null,
|
||||
url: "rtmp://live-push.shopxo.vip/68f764013572f9240ca7ce6c/shopxo"
|
||||
}
|
||||
},
|
||||
onReady() {
|
||||
// 注意:需要在onReady中 或 onLoad 延时
|
||||
var self = this;
|
||||
setTimeout(function() {
|
||||
self.context = uni.createLivePusherContext("livePusher", self);
|
||||
}, 2000);
|
||||
},
|
||||
methods: {
|
||||
statechange(e) {
|
||||
},
|
||||
methods: {
|
||||
statechange(e) {
|
||||
console.log("statechange:" + JSON.stringify(e));
|
||||
},
|
||||
netstatus(e) {
|
||||
|
|
@ -41,7 +55,6 @@
|
|||
console.log("error:" + JSON.stringify(e));
|
||||
},
|
||||
start: function() {
|
||||
console.log(this.context)
|
||||
this.context.start({
|
||||
success: (a) => {
|
||||
console.log("livePusher.start:" + JSON.stringify(a));
|
||||
|
|
@ -104,9 +117,6 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Loading…
Reference in New Issue