视频问题修改
This commit is contained in:
parent
7038e38809
commit
e4986834f2
File diff suppressed because one or more lines are too long
|
@ -1,123 +1,109 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="player"></div>
|
<div id="player"></div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import api from '@/axios'
|
import api from '@/axios'
|
||||||
import { Ref, ref, watch, onMounted, onBeforeMount, onBeforeUnmount, reactive, getCurrentInstance } from 'vue'
|
import { Ref, ref, watch, onMounted, onBeforeMount, onBeforeUnmount, reactive, getCurrentInstance } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const infoData = ref()
|
const infoData = ref()
|
||||||
var curIndex = 0 // 当前窗口下标
|
var curIndex = 0 // 当前窗口下标
|
||||||
let myPlugin: any
|
let myPlugin : any
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (typeof window.JSPlugin === 'undefined') {
|
if (typeof window.JSPlugin === 'undefined') {
|
||||||
console.error('JSPlugin is not loaded')
|
return
|
||||||
return
|
} else {
|
||||||
} else {
|
}
|
||||||
console.log('JSPlugin加载成功')
|
let date = {
|
||||||
}
|
pointId: router.currentRoute.value.query.pointId,
|
||||||
let date = {
|
useTLS: 0,
|
||||||
pointId: router.currentRoute.value.query.pointId,
|
}
|
||||||
useTLS: 0,
|
if (process.env.NODE_ENV === 'production') {
|
||||||
}
|
date.useTLS = 1
|
||||||
if (process.env.NODE_ENV === 'production') {
|
}
|
||||||
date.useTLS = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
api.post('/multialarm/video/preview', { ...date }).then((res) => {
|
api.post('/multialarm/video/preview', { ...date }).then((res) => {
|
||||||
console.log('router222', res)
|
// console.log('router222', res)
|
||||||
console.log('播放地址', res.data.videoUrl)
|
console.log('播放地址', res.data.videoUrl)
|
||||||
var code = res['code']
|
var code = res['code']
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
var playURL = res.data.videoUrl
|
var playURL = res.data.videoUrl
|
||||||
var IS_MOVE_DEVICE = document.body.clientWidth < 992 // 是否移动设备
|
// var playURL = 'wss://w.hnjinglian.cn:2563/haikang play/openUrl/w64vRni'
|
||||||
var MSE_IS_SUPPORT = !!window.MediaSource // 是否支持mse
|
var IS_MOVE_DEVICE = document.body.clientWidth < 992 // 是否移动设备
|
||||||
myPlugin = new window.JSPlugin({
|
var MSE_IS_SUPPORT = !!window.MediaSource // 是否支持mse
|
||||||
// 当容器div#play_window有固定宽高时,可不传iWidth和iHeight,窗口大小将自适应容器宽高
|
myPlugin = new window.JSPlugin({
|
||||||
// iWidth: 600,
|
// 当容器div#play_window有固定宽高时,可不传iWidth和iHeight,窗口大小将自适应容器宽高
|
||||||
// iHeight: 400,
|
// iWidth: 600,
|
||||||
szId: 'player', //需要英文字母开头,唯一性,必填
|
// iHeight: 400,
|
||||||
szBasePath: './', // 必填,与h5player.min.js的引用目录一致
|
szId: 'player', //需要英文字母开头,唯一性,必填
|
||||||
iMaxSplit: 1, // 分屏播放,默认最大分屏4*4
|
szBasePath: './', // 必填,与h5player.min.js的引用目录一致
|
||||||
iCurrentSplit: IS_MOVE_DEVICE ? 1 : 2,
|
iMaxSplit: 1, // 分屏播放,默认最大分屏4*4
|
||||||
openDebug: true,
|
iCurrentSplit: IS_MOVE_DEVICE ? 1 : 2,
|
||||||
oStyle: {
|
openDebug: true,
|
||||||
borderSelect: IS_MOVE_DEVICE ? '#000' : '#FFCC00',
|
oStyle: {
|
||||||
},
|
borderSelect: IS_MOVE_DEVICE ? '#000' : '#FFCC00',
|
||||||
bSupporDoubleClickFull: true, //是否支持双击全屏,默认true
|
},
|
||||||
})
|
bSupporDoubleClickFull: true, //是否支持双击全屏,默认true
|
||||||
myPlugin
|
})
|
||||||
.JS_SetWindowControlCallback({
|
myPlugin.JS_SetWindowControlCallback({
|
||||||
pluginErrorHandler: function (index: any, iErrorCode: any, oError: any) {
|
pluginErrorHandler: function (index : any, iErrorCode : any, oError : any) {
|
||||||
console.error('__________pluginErrorHandler错误码________________', index, iErrorCode, oError)
|
|
||||||
|
|
||||||
//插件错误回调
|
},
|
||||||
// do you want...
|
})
|
||||||
// 取流失败,流中断等错误都会触发该回调函数,请自行对照错误码表进行判断。
|
.then((res : any) => {
|
||||||
// 业务上层可在此做一些个性化操作,如:个性化错误信息展示,重新取流等。
|
})
|
||||||
},
|
|
||||||
})
|
|
||||||
.then((res: any) => {
|
|
||||||
console.log('JS_SetWindowControlCallback________________', res)
|
|
||||||
})
|
|
||||||
|
|
||||||
var controlIndex = 2
|
var controlIndex = 2
|
||||||
function playVideo() {
|
function playVideo() {
|
||||||
console.log('____________playURL:', playURL)
|
myPlugin
|
||||||
console.log('____________curIndex:', curIndex)
|
.JS_Play(
|
||||||
// JS_Play 参数说明
|
playURL,
|
||||||
// JS_Play(url, config, windowIndex, startTime, endTime)
|
{
|
||||||
myPlugin
|
playURL: playURL, // 流媒体播放时必传
|
||||||
.JS_Play(
|
mode: 1, // 解码类型:0=普通模式; 1=高级模式 默认为0
|
||||||
playURL,
|
},
|
||||||
{
|
curIndex //当前窗口下标
|
||||||
playURL: playURL, // 流媒体播放时必传
|
)
|
||||||
mode: 1, // 解码类型:0=普通模式; 1=高级模式 默认为0
|
.then(
|
||||||
},
|
() => {
|
||||||
curIndex //当前窗口下标
|
},
|
||||||
)
|
(e : any) => {
|
||||||
.then(
|
// console.log('网络流中断')
|
||||||
() => {
|
controlIndex--
|
||||||
console.info('JS_Play success')
|
if (controlIndex <= 0) {
|
||||||
// do you want...
|
return
|
||||||
},
|
}
|
||||||
(e: any) => {
|
// console.info('JS_Play failed:', e)
|
||||||
console.log('网络流中断')
|
playVideo()
|
||||||
controlIndex--
|
}
|
||||||
if (controlIndex <= 0) {
|
)
|
||||||
return
|
}
|
||||||
}
|
playVideo()
|
||||||
console.info('JS_Play failed:', e)
|
} else {
|
||||||
playVideo()
|
alert('播放失败')
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
}
|
})
|
||||||
playVideo()
|
|
||||||
} else {
|
|
||||||
alert('播放失败')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
// 停止播放断开 ws 连接
|
// 停止播放断开 ws 连接
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
myPlugin.JS_Stop(curIndex).then(
|
myPlugin.JS_Stop(curIndex).then(
|
||||||
() => {
|
() => {
|
||||||
console.info('JS_Stop success')
|
console.info('JS_Stop success')
|
||||||
// do you want...
|
// do you want...
|
||||||
},
|
},
|
||||||
(err: any) => {
|
(err : any) => {
|
||||||
console.info('JS_Stop failed:', err)
|
console.info('JS_Stop failed:', err)
|
||||||
// do you want...
|
// do you want...
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
#player {
|
#player {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #000;
|
background: #000;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -1059,12 +1059,12 @@ const pointCode = ref()
|
||||||
if (a.deviceType == '00') {
|
if (a.deviceType == '00') {
|
||||||
if (a.alarmType == 'isc') {
|
if (a.alarmType == 'isc') {
|
||||||
try {
|
try {
|
||||||
router.push({ path: '/index/hkplay', query: { pointId: a.pointId } })
|
// router.push({ path: '/index/hkplay', query: { pointId: a.pointId } })
|
||||||
// let routeData = router.resolve({ path: '/index/hkplay', query: { pointId: a.pointId } })
|
let routeData = router.resolve({ path: '/index/hkplay', query: { pointId: a.pointId } })
|
||||||
// console.log('🚀 ~ routeData:', JSON.stringify(routeData))
|
// console.log('🚀 ~ routeData:', JSON.stringify(routeData))
|
||||||
// window.location.href = routeData.href
|
// window.location.href = routeData.href
|
||||||
|
|
||||||
// window.open(routeData.href, '_blank')
|
window.open(routeData.href, '_blank')
|
||||||
// window.open('http://172.10.10.161:9527/#/index/hkplay?pointId=43000000581314000013', '_blank') //直接跳要么白屏,要么说未找到token
|
// window.open('http://172.10.10.161:9527/#/index/hkplay?pointId=43000000581314000013', '_blank') //直接跳要么白屏,要么说未找到token
|
||||||
// window.open('https://www.hndyjqrh.cn/#/index/hkplay?pointId=43000000581314000013', '_blank')
|
// window.open('https://www.hndyjqrh.cn/#/index/hkplay?pointId=43000000581314000013', '_blank')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue