|
|
@@ -3,8 +3,9 @@
|
|
|
<view class="page-panel">
|
|
|
<!-- 监控区域 -->
|
|
|
<view class="monitor-area">
|
|
|
+ <view class="video-js" ref="video" style="width: 100%;height:510rpx;"></view>
|
|
|
<!-- <image src="@/static/demo/demo1.png" mode="widthFix"></image> -->
|
|
|
- <video id="hlsId" autoplay controls style="width: 100%;height:800rpx"></video>
|
|
|
+ <!-- <video id="hlsId" autoplay controls style="width: 100%;height:800rpx"></video> -->
|
|
|
</view>
|
|
|
<!-- 监控工具 -->
|
|
|
<view class="monitor-tools">
|
|
|
@@ -26,7 +27,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import EZUIKit from "ezuikit-js";
|
|
|
+ import Hls from 'hls.js'
|
|
|
+ import Dplayer from 'dplayer'
|
|
|
import {
|
|
|
getCameraAddress,
|
|
|
controlCamera
|
|
|
@@ -45,18 +47,61 @@
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
- onLoad(options) {
|
|
|
+ onLoad(options) {
|
|
|
this.deviceId = options.id;
|
|
|
this.controlParams.device_id = options.id;
|
|
|
|
|
|
},
|
|
|
- onReady() {
|
|
|
- this.getCameraAddress();
|
|
|
-
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- console.log('d');
|
|
|
- new EZUIKit.HLS("hlsId","http://cmgw-vpc.lechange.com:8888/LCO/8C02697PAJ9FA37/0/1/20220908T101239/d14740c6649a2c1eb8f8fbc2f4fd7a8e.m3u8");
|
|
|
+ async onReady() {
|
|
|
+ await this.getCameraAddress();
|
|
|
+ let video = document.createElement('video');
|
|
|
+ video.id = 'video';
|
|
|
+ video.style = 'width: 100%; height:510rpx;';
|
|
|
+ video.controls = true;
|
|
|
+ video.preload = "auto"
|
|
|
+ video.setAttribute('playsinline', true) //IOS微信浏览器支持小窗内播放
|
|
|
+ video.setAttribute('webkit-playsinline', true) //这个bai属性是ios 10中设置可以让视频在小du窗内播放,也就是不是全zhi屏播放的video标签的一个属性
|
|
|
+ video.setAttribute('x5-video-player-type', 'h5') //安卓 声明启用同层H5播放器 可以在video上面加东西
|
|
|
+ let source = document.createElement('source');
|
|
|
+ source.src =this.cameraAddress;
|
|
|
+ // 'http://yun-live.oss-cn-shanghai.aliyuncs.com/record/yunlive/record/yunlive/meeting_1070/2020-11-25-09-27-59_2020-11-25-09-35-52.m3u8';
|
|
|
+ // source.type = 'application/x-mpegURL';
|
|
|
+ video.appendChild(source);
|
|
|
+ this.$refs.video.$el.appendChild(video);
|
|
|
+ let that = this;
|
|
|
+ let player = this.$video('video', {
|
|
|
+ poster: '', // 视频封面图地址
|
|
|
+ title: '4564564',
|
|
|
+ playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
|
|
|
+ autoDisable: true,
|
|
|
+ preload: 'none', //auto - 当页面加载后载入整个视频 meta - 当页面加载后只载入元数据 none - 当页面加载后不载入视频
|
|
|
+ language: 'zh-CN',
|
|
|
+ fluid: true, // 自适应宽高
|
|
|
+ muted: false, // 是否静音
|
|
|
+ aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
|
|
|
+ controls: true, //是否拥有控制条 【默认true】,如果设为false ,那么只能通过api进行控制了。也就是说界面上不会出现任何控制按钮
|
|
|
+ autoplay: true, //如果true,浏览器准备好时开始回放。 autoplay: "muted", // //自动播放属性,muted:静音播放
|
|
|
+ loop: true, // 导致视频一结束就重新开始。 视频播放结束后,是否循环播放
|
|
|
+ screenshot: true,
|
|
|
+ controlBar: {
|
|
|
+ volumePanel: { //声音样式
|
|
|
+ inline: false // 不使用水平方式
|
|
|
+ },
|
|
|
+ timeDivider: true, // 时间分割线
|
|
|
+ durationDisplay: true, // 总时间
|
|
|
+ progressControl: true, // 进度条
|
|
|
+ remainingTimeDisplay: true, //当前以播放时间
|
|
|
+ fullscreenToggle: true, //全屏按钮
|
|
|
+ pictureInPictureToggle: true, //画中画
|
|
|
+ }
|
|
|
+ }, function() {
|
|
|
+ this.on('error', function(err) { //请求数据时遇到错误
|
|
|
+ console.log("请求数据时遇到错误", err)
|
|
|
+ });
|
|
|
+ this.on('stalled', function(stalled) { //网速失速
|
|
|
+ console.log("网速失速", stalled)
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取监控播放地址
|
|
|
@@ -64,8 +109,9 @@
|
|
|
let res = await getCameraAddress({
|
|
|
device_id: this.deviceId
|
|
|
});
|
|
|
- // console.log(res.hls);
|
|
|
- // console.log(JSON.parse(res));
|
|
|
+ let address = eval("(" + res + ")")
|
|
|
+ console.log(address.hls);
|
|
|
+ this.cameraAddress=address.hls;
|
|
|
},
|
|
|
// 控制摄像机
|
|
|
async controlDirection(movenum) {
|