wx-program
pangdundun 2024-01-26 11:29:08 +08:00
parent 748351ce99
commit 535bde6548
8 changed files with 100 additions and 46 deletions

View File

@ -17,10 +17,14 @@
<image src="../../static/timer.png" mode=""></image>
<text>{{ time }}</text>
</view>
<view class="right" @click="toVideoLive(item.cameraSerialNumber,item.cameraChannelNumber)">
<view class="right" @click="toMiniProgram(item.cameraSerialNumber,item.cameraChannelNumber)">
<image src="../../static/play.png" mode=""></image>
<text>现场实况</text>
</view>
<!-- <view class="right" @click="toMiniProgram('AD6463273', 11)">
<image src="../../static/play.png" mode=""></image>
<text>现场实况</text>
</view> -->
</view>
</view>
</view>
@ -102,29 +106,53 @@
// })
// },
toMiniProgram(){
uni.navigateToMiniProgram({
appId: 'wxf2b3a0262975d8c2',
path: 'pages/live/live?accessToken=' + this.accesstoken + '&deviceSerial=AD6463273&channelNo=11',
success(res) {
console.log(res);
}
})
},
toVideoLive(cameraSerialNumber,cameraChannelNumber) {
if(cameraSerialNumber && cameraChannelNumber){
uni.navigateTo({
url: '/pages/videoLive/videoLive?cameraSerialNumber=' + cameraSerialNumber + '&cameraChannelNumber=' + cameraChannelNumber
toMiniProgram(cameraid,channelid){
if(cameraid && channelid){
this.$http({
url: this.api.camera_gethls,
method: 'GET',
data: {
cameraid,
channelid
}
}).then(res => {
if (res.code == 200) {
this.accesstoken = res.data.accesstoken;
this.src = res.data.ezopen;
uni.navigateToMiniProgram({
appId: 'wxf2b3a0262975d8c2',
path: 'pages/live/live?accessToken=' + this.accesstoken + '&deviceSerial=' + cameraid + '&channelNo=' + channelid,
success(res) {
console.log(res);
}
})
}
})
}else{
uni.showToast({
icon:'none',
icon:'error',
title: '暂无监控数据',
duration: 2000
});
}
},
// toVideoLive(cameraSerialNumber,cameraChannelNumber) {
// if(cameraSerialNumber && cameraChannelNumber){
// uni.navigateTo({
// url: '/pages/videoLive/videoLive?cameraSerialNumber=' + cameraSerialNumber + '&cameraChannelNumber=' + cameraChannelNumber
// })
// }else{
// uni.showToast({
// icon:'none',
// title: '',
// duration: 2000
// });
// }
// },
getCurrentTime() {
const now = new Date();

View File

@ -5,8 +5,8 @@
<view class="center">
<view class="video_live">
<!-- <image src="../../static/videoLive.png" mode=""></image> -->
<video id="myVideo" style="width: 100%;height: 100%;" src="https://open.ys7.com/v3/openlive/AK5743927_7_2.m3u8?expire=1706319207&id=670924254623047680&t=8da412e4fc771057b4857d65ebb164168256d1cabd23aad0872faec529c6f896&ev=100" controls></video>
<image src="../../static/videoLive.png" mode=""></image>
<!-- <video id="myVideo" style="width: 100%;height: 100%;" src="https://open.ys7.com/v3/openlive/AK5743927_7_2.m3u8?expire=1706319207&id=670924254623047680&t=8da412e4fc771057b4857d65ebb164168256d1cabd23aad0872faec529c6f896&ev=100" controls></video> -->
</view>
<view class="skills">
@ -85,12 +85,12 @@
console.log(options,'00');
this.cameraSerialNumber = options.cameraSerialNumber;
this.cameraChannelNumber = options.cameraChannelNumber
this.getVideoData(this.cameraSerialNumber, this.cameraChannelNumber)
// this.getVideoData(this.cameraSerialNumber, this.cameraChannelNumber)
let that = this;
let livePlayerContext = uni.createLivePlayerContext('myVideo');
// let that = this;
// let livePlayerContext = uni.createLivePlayerContext('myVideo');
//
livePlayerContext.play();
// livePlayerContext.play();
//
// livePlayerContext.onEnded(function () {
// console.log('');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -193,6 +193,10 @@ exports.default = void 0;
//
//
//
//
//
//
//
var _default = {
data: function data() {
return {
@ -264,28 +268,50 @@ var _default = {
// }
// })
// },
toMiniProgram: function toMiniProgram() {
uni.navigateToMiniProgram({
appId: 'wxf2b3a0262975d8c2',
path: 'pages/live/live?accessToken=' + this.accesstoken + '&deviceSerial=AD6463273&channelNo=11',
success: function success(res) {
console.log(res);
}
});
},
toVideoLive: function toVideoLive(cameraSerialNumber, cameraChannelNumber) {
if (cameraSerialNumber && cameraChannelNumber) {
uni.navigateTo({
url: '/pages/videoLive/videoLive?cameraSerialNumber=' + cameraSerialNumber + '&cameraChannelNumber=' + cameraChannelNumber
toMiniProgram: function toMiniProgram(cameraid, channelid) {
var _this3 = this;
if (cameraid && channelid) {
this.$http({
url: this.api.camera_gethls,
method: 'GET',
data: {
cameraid: cameraid,
channelid: channelid
}
}).then(function (res) {
if (res.code == 200) {
_this3.accesstoken = res.data.accesstoken;
_this3.src = res.data.ezopen;
uni.navigateToMiniProgram({
appId: 'wxf2b3a0262975d8c2',
path: 'pages/live/live?accessToken=' + _this3.accesstoken + '&deviceSerial=' + cameraid + '&channelNo=' + channelid,
success: function success(res) {
console.log(res);
}
});
}
});
} else {
uni.showToast({
icon: 'none',
icon: 'error',
title: '暂无监控数据',
duration: 2000
});
}
},
// toVideoLive(cameraSerialNumber,cameraChannelNumber) {
// if(cameraSerialNumber && cameraChannelNumber){
// uni.navigateTo({
// url: '/pages/videoLive/videoLive?cameraSerialNumber=' + cameraSerialNumber + '&cameraChannelNumber=' + cameraChannelNumber
// })
// }else{
// uni.showToast({
// icon:'none',
// title: '暂无监控数据',
// duration: 2000
// });
// }
// },
getCurrentTime: function getCurrentTime() {
var now = new Date();
var year = now.getFullYear();

View File

@ -1 +1 @@
<view class="timeVideo data-v-dd7dcdb8"><u-navbar vue-id="d23ae73c-1" background="{{background}}" is-back="{{true}}" back-icon-color="#FFFFFF" border-bottom="{{false}}" title="实时视频" title-color="#FFFFFF" title-bold="{{true}}" title-size="32" class="data-v-dd7dcdb8" bind:__l="__l"></u-navbar><view class="content data-v-dd7dcdb8"><block wx:for="{{deviceList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view class="item data-v-dd7dcdb8"><view class="nav data-v-dd7dcdb8"><image src="../../static/video.png" mode class="data-v-dd7dcdb8"></image><text class="data-v-dd7dcdb8">{{item.deviceTypeName+"-摄像机#2"}}</text></view><view class="video data-v-dd7dcdb8"><image src="../../static/video1.png" mode class="data-v-dd7dcdb8"></image></view><view class="timer data-v-dd7dcdb8"><view class="left data-v-dd7dcdb8"><image src="../../static/timer.png" mode class="data-v-dd7dcdb8"></image><text class="data-v-dd7dcdb8">{{time}}</text></view><view data-event-opts="{{[['tap',[['toVideoLive',['$0','$1'],[[['deviceList','',index,'cameraSerialNumber']],[['deviceList','',index,'cameraChannelNumber']]]]]]]}}" class="right data-v-dd7dcdb8" bindtap="__e"><image src="../../static/play.png" mode class="data-v-dd7dcdb8"></image><text class="data-v-dd7dcdb8">现场实况</text></view></view></view></block></view></view>
<view class="timeVideo data-v-dd7dcdb8"><u-navbar vue-id="d23ae73c-1" background="{{background}}" is-back="{{true}}" back-icon-color="#FFFFFF" border-bottom="{{false}}" title="实时视频" title-color="#FFFFFF" title-bold="{{true}}" title-size="32" class="data-v-dd7dcdb8" bind:__l="__l"></u-navbar><view class="content data-v-dd7dcdb8"><block wx:for="{{deviceList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view class="item data-v-dd7dcdb8"><view class="nav data-v-dd7dcdb8"><image src="../../static/video.png" mode class="data-v-dd7dcdb8"></image><text class="data-v-dd7dcdb8">{{item.deviceTypeName+"-摄像机#2"}}</text></view><view class="video data-v-dd7dcdb8"><image src="../../static/video1.png" mode class="data-v-dd7dcdb8"></image></view><view class="timer data-v-dd7dcdb8"><view class="left data-v-dd7dcdb8"><image src="../../static/timer.png" mode class="data-v-dd7dcdb8"></image><text class="data-v-dd7dcdb8">{{time}}</text></view><view data-event-opts="{{[['tap',[['toMiniProgram',['$0','$1'],[[['deviceList','',index,'cameraSerialNumber']],[['deviceList','',index,'cameraChannelNumber']]]]]]]}}" class="right data-v-dd7dcdb8" bindtap="__e"><image src="../../static/play.png" mode class="data-v-dd7dcdb8"></image><text class="data-v-dd7dcdb8">现场实况</text></view></view></view></block></view></view>

View File

@ -158,7 +158,7 @@ __webpack_require__.r(__webpack_exports__);
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(uni) {
Object.defineProperty(exports, "__esModule", {
value: true
@ -249,11 +249,12 @@ var _default = {
console.log(options, '00');
this.cameraSerialNumber = options.cameraSerialNumber;
this.cameraChannelNumber = options.cameraChannelNumber;
this.getVideoData(this.cameraSerialNumber, this.cameraChannelNumber);
var that = this;
var livePlayerContext = uni.createLivePlayerContext('myVideo');
// this.getVideoData(this.cameraSerialNumber, this.cameraChannelNumber)
// let that = this;
// let livePlayerContext = uni.createLivePlayerContext('myVideo');
// 播放直播
livePlayerContext.play();
// livePlayerContext.play();
// 监听直播播放结束事件
// livePlayerContext.onEnded(function () {
// console.log('直播播放结束');
@ -304,7 +305,6 @@ var _default = {
}
};
exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
/***/ }),

View File

@ -1 +1 @@
<view class="videoLive data-v-0ceca996"><u-navbar vue-id="deadeba0-1" background="{{background}}" is-back="{{true}}" back-icon-color="#FFFFFF" border-bottom="{{false}}" title="摄像机01" title-color="#FFFFFF" title-bold="{{true}}" title-size="32" class="data-v-0ceca996" bind:__l="__l"></u-navbar><view class="center data-v-0ceca996"><view class="video_live data-v-0ceca996"><video style="width:100%;height:100%;" id="myVideo" src="https://open.ys7.com/v3/openlive/AK5743927_7_2.m3u8?expire=1706319207&id=670924254623047680&t=8da412e4fc771057b4857d65ebb164168256d1cabd23aad0872faec529c6f896&ev=100" controls="{{true}}" class="data-v-0ceca996"></video></view><view class="skills data-v-0ceca996"><view class="left data-v-0ceca996"><image src="../../static/direction_keys.png" mode class="data-v-0ceca996"></image><image class="left_arrow data-v-0ceca996" src="../../static/left_arrow.png" mode></image><image class="right_arrow data-v-0ceca996" src="../../static/right_arrow.png" mode></image><image class="up_arrow data-v-0ceca996" src="../../static/up_arrow.png" mode></image><image class="down_arrow data-v-0ceca996" src="../../static/down_arrow.png" mode></image></view><view class="right data-v-0ceca996"><view class="right_item data-v-0ceca996"><view data-event-opts="{{[['tap',[['focus_addClick',['$event']]]]]}}" class="{{['data-v-0ceca996',flag1?'add_act':'add']}}" bindtap="__e"><block wx:if="{{flag1==true}}"><image src="../../static/add_act.png" mode class="data-v-0ceca996"></image></block><block wx:if="{{flag1==false}}"><image src="../../static/add.png" mode class="data-v-0ceca996"></image></block></view><view class="focus data-v-0ceca996">焦距</view><view data-event-opts="{{[['tap',[['focus_subtractClick',['$event']]]]]}}" class="{{['data-v-0ceca996',flag1?'subtract':'subtract_act']}}" bindtap="__e"><block wx:if="{{flag1==true}}"><image src="../../static/subtract.png" mode class="data-v-0ceca996"></image></block><block wx:if="{{flag1==false}}"><image src="../../static/subtract_act.png" mode class="data-v-0ceca996"></image></block></view></view><view class="right_item data-v-0ceca996"><view data-event-opts="{{[['tap',[['scale_addClick',['$event']]]]]}}" class="{{['data-v-0ceca996',flag2?'add_act':'add']}}" bindtap="__e"><block wx:if="{{flag2==true}}"><image src="../../static/add_act.png" mode class="data-v-0ceca996"></image></block><block wx:if="{{flag2==false}}"><image src="../../static/add.png" mode class="data-v-0ceca996"></image></block></view><view class="focus data-v-0ceca996">缩放</view><view data-event-opts="{{[['tap',[['scale_subtractClick',['$event']]]]]}}" class="{{['data-v-0ceca996',flag2?'subtract':'subtract_act']}}" bindtap="__e"><block wx:if="{{flag2==true}}"><image src="../../static/subtract.png" mode class="data-v-0ceca996"></image></block><block wx:if="{{flag2==false}}"><image src="../../static/subtract_act.png" mode class="data-v-0ceca996"></image></block></view></view><view class="right_item data-v-0ceca996"><view data-event-opts="{{[['tap',[['aperture_addClick',['$event']]]]]}}" class="{{['data-v-0ceca996',flag3?'add_act':'add']}}" bindtap="__e"><block wx:if="{{flag3==true}}"><image src="../../static/add_act.png" mode class="data-v-0ceca996"></image></block><block wx:if="{{flag3==false}}"><image src="../../static/add.png" mode class="data-v-0ceca996"></image></block></view><view class="focus data-v-0ceca996">光圈</view><view data-event-opts="{{[['tap',[['aperture_subtractClick',['$event']]]]]}}" class="{{['data-v-0ceca996',flag3?'subtract':'subtract_act']}}" bindtap="__e"><block wx:if="{{flag3==true}}"><image src="../../static/subtract.png" mode class="data-v-0ceca996"></image></block><block wx:if="{{flag3==false}}"><image src="../../static/subtract_act.png" mode class="data-v-0ceca996"></image></block></view></view></view></view></view></view>
<view class="videoLive data-v-0ceca996"><u-navbar vue-id="deadeba0-1" background="{{background}}" is-back="{{true}}" back-icon-color="#FFFFFF" border-bottom="{{false}}" title="摄像机01" title-color="#FFFFFF" title-bold="{{true}}" title-size="32" class="data-v-0ceca996" bind:__l="__l"></u-navbar><view class="center data-v-0ceca996"><view class="video_live data-v-0ceca996"><image src="../../static/videoLive.png" mode class="data-v-0ceca996"></image></view><view class="skills data-v-0ceca996"><view class="left data-v-0ceca996"><image src="../../static/direction_keys.png" mode class="data-v-0ceca996"></image><image class="left_arrow data-v-0ceca996" src="../../static/left_arrow.png" mode></image><image class="right_arrow data-v-0ceca996" src="../../static/right_arrow.png" mode></image><image class="up_arrow data-v-0ceca996" src="../../static/up_arrow.png" mode></image><image class="down_arrow data-v-0ceca996" src="../../static/down_arrow.png" mode></image></view><view class="right data-v-0ceca996"><view class="right_item data-v-0ceca996"><view data-event-opts="{{[['tap',[['focus_addClick',['$event']]]]]}}" class="{{['data-v-0ceca996',flag1?'add_act':'add']}}" bindtap="__e"><block wx:if="{{flag1==true}}"><image src="../../static/add_act.png" mode class="data-v-0ceca996"></image></block><block wx:if="{{flag1==false}}"><image src="../../static/add.png" mode class="data-v-0ceca996"></image></block></view><view class="focus data-v-0ceca996">焦距</view><view data-event-opts="{{[['tap',[['focus_subtractClick',['$event']]]]]}}" class="{{['data-v-0ceca996',flag1?'subtract':'subtract_act']}}" bindtap="__e"><block wx:if="{{flag1==true}}"><image src="../../static/subtract.png" mode class="data-v-0ceca996"></image></block><block wx:if="{{flag1==false}}"><image src="../../static/subtract_act.png" mode class="data-v-0ceca996"></image></block></view></view><view class="right_item data-v-0ceca996"><view data-event-opts="{{[['tap',[['scale_addClick',['$event']]]]]}}" class="{{['data-v-0ceca996',flag2?'add_act':'add']}}" bindtap="__e"><block wx:if="{{flag2==true}}"><image src="../../static/add_act.png" mode class="data-v-0ceca996"></image></block><block wx:if="{{flag2==false}}"><image src="../../static/add.png" mode class="data-v-0ceca996"></image></block></view><view class="focus data-v-0ceca996">缩放</view><view data-event-opts="{{[['tap',[['scale_subtractClick',['$event']]]]]}}" class="{{['data-v-0ceca996',flag2?'subtract':'subtract_act']}}" bindtap="__e"><block wx:if="{{flag2==true}}"><image src="../../static/subtract.png" mode class="data-v-0ceca996"></image></block><block wx:if="{{flag2==false}}"><image src="../../static/subtract_act.png" mode class="data-v-0ceca996"></image></block></view></view><view class="right_item data-v-0ceca996"><view data-event-opts="{{[['tap',[['aperture_addClick',['$event']]]]]}}" class="{{['data-v-0ceca996',flag3?'add_act':'add']}}" bindtap="__e"><block wx:if="{{flag3==true}}"><image src="../../static/add_act.png" mode class="data-v-0ceca996"></image></block><block wx:if="{{flag3==false}}"><image src="../../static/add.png" mode class="data-v-0ceca996"></image></block></view><view class="focus data-v-0ceca996">光圈</view><view data-event-opts="{{[['tap',[['aperture_subtractClick',['$event']]]]]}}" class="{{['data-v-0ceca996',flag3?'subtract':'subtract_act']}}" bindtap="__e"><block wx:if="{{flag3==true}}"><image src="../../static/subtract.png" mode class="data-v-0ceca996"></image></block><block wx:if="{{flag3==false}}"><image src="../../static/subtract_act.png" mode class="data-v-0ceca996"></image></block></view></view></view></view></view></view>