h5player播放接口添加

This commit is contained in:
chenchenzai 2022-11-21 20:32:28 +08:00
parent ffbf434cd7
commit c619d24cf9
5 changed files with 84 additions and 18 deletions

View File

@ -117,11 +117,22 @@ export function getPlaceType() {
//西 //西
export function CameraConditionPlaceType(params) { export function CameraConditionPlaceType(params) {
return axios.post( return axios.post(
'http://10.134.135.92:9537/data_service/getCamera/CameraConditionPlaceType', 'http://10.134.135.92:9537/data_service/getCamera/CameraConditionPlaceType' +
params, params,
config2 config2
) )
} }
// 西wss
export function getCameraLiveStream(params) {
return axios.get(
'http://10.134.135.92:9537/data_service/getCamera/getCameraLiveStream?cameraIndexCode=' +
params.channelId +
'&protocol=' +
'wss' + '&transmode=1&streamType=1',
config2
)
}
// 西-- (10.134.135.92:9537) // 西-- (10.134.135.92:9537)
let _cameraUrl = let _cameraUrl =
(_global && (_global &&

View File

@ -1734,8 +1734,9 @@ export function MapFun(mapObj) {
// }) // })
// } // }
marker.on('click', e => { marker.on('click', e => {
console.log('点位数据', e) //console.log('', e)
clickDataList.push(e.resourceData); //console.log('1', e.sourceTarget.resourceData)
clickDataList.push(e.sourceTarget.resourceData);
// marker // marker
//const layers = layerGroup.get(layerName).getLayers() //const layers = layerGroup.get(layerName).getLayers()
// layers.forEach((layer) => { // layers.forEach((layer) => {

View File

@ -7,6 +7,7 @@
<script> <script>
const IS_MOVE_DEVICE = document.body.clientWidth < 992 // const IS_MOVE_DEVICE = document.body.clientWidth < 992 //
const MSE_IS_SUPPORT = !!window.MediaSource // mse const MSE_IS_SUPPORT = !!window.MediaSource // mse
import { message } from 'ant-design-vue'
export default { export default {
name: 'H5Player', name: 'H5Player',
props: { props: {
@ -57,7 +58,19 @@ const MSE_IS_SUPPORT = !!window.MediaSource // 是否支持mse
this.createPlayer() this.createPlayer()
this.arrangeWindow() this.arrangeWindow()
//videoUrl this.realplay(this.videoUrl,0);//index //videoUrl this.realplay(this.videoUrl,0);//index
this.realplay('wss://10.134.135.44:6014/proxy/10.10.20.14:559/openUrl/y3mFfcA',0); this.realplay(this.videoUrl,0);
//this.realplay('wss://10.134.135.44:6014/proxy/10.10.20.14:559/openUrl/y3mFfcA',0);
},
watch: {
videoUrl: {
//
handler(newVal, oldVal) {
console.log('oldVal:', oldVal)
console.log('newVal:', newVal)
},
//
immediate: true
}
}, },
methods: { methods: {
// //
@ -127,7 +140,10 @@ const MSE_IS_SUPPORT = !!window.MediaSource // 是否支持mse
() => { () => {
console.log('realplay success') console.log('realplay success')
}, },
e => { console.error(e) } e => {
console.error(e);
message.error('请联系视频提供方!')
}
) )
}, },
// //

View File

@ -28,11 +28,11 @@
<h5-player :video-url="videoUrl"></h5-player> <h5-player :video-url="videoUrl"></h5-player>
</div> </div>
<div class="text-label"> <div class="text-label">
<span>{{defaultIndex}}</span>/<span>{{cameraDataList.length}}</span> <span>{{defaultIndex+1}}</span>/<span>{{cameraDataList.length}}</span>
</div> </div>
<div class="footer-button"> <div class="footer-button">
<a-button type="primary" @click="applyNow(url)">立即申请</a-button> <a-button type="primary" @click="applyNow(cameraDataList[defaultIndex])">立即申请</a-button>
<a-button type="primary" style="margin-left:20px" @click="addIntoCart(url)">加入申购车</a-button> <a-button type="primary" style="margin-left:20px" @click="addIntoCart(cameraDataList[defaultIndex])">加入申购车</a-button>
</div> </div>
</div> </div>
</div> </div>
@ -46,9 +46,11 @@
LeftCircleOutlined, LeftCircleOutlined,
RightCircleOutlined, RightCircleOutlined,
} from '@ant-design/icons-vue' } from '@ant-design/icons-vue'
import { useRouter } from 'vue-router'
import H5Player from '@/views/home/components/H5Player.vue' import H5Player from '@/views/home/components/H5Player.vue'
import mybus from '@/myplugins/mybus' import mybus from '@/myplugins/mybus'
import { getStreamByChannelCode } from '@/api/videoSurveillance' import { getStreamByChannelCode } from '@/api/videoSurveillance'
import {getCameraLiveStream} from '@/api/file'
export default { export default {
name: '', name: '',
components: { components: {
@ -65,7 +67,9 @@
}, },
}, },
}, },
mounted() {}, mounted() {
this.getVideoUrl(this.cameraDataList[this.defaultIndex]);
},
// directives: { // directives: {
// viewer: viewer({ // viewer: viewer({
// debug: true, // debug: true,
@ -76,7 +80,8 @@
openVideo: false, openVideo: false,
videoStream: '', videoStream: '',
videoUrl:'', //url videoUrl:'', //url
defaultIndex:0// defaultIndex:0,//
router:useRouter()
} }
}, },
methods: { methods: {
@ -90,32 +95,59 @@
// //
applyNow(item){ applyNow(item){
console.log('applyNowapplyNow',item); console.log('applyNowapplyNow',item);
mybus.emit('selectCamera', item) //
this.router.push({
path: '/apply',
query: {
},
})
}, },
// //
addIntoCart(item){ addIntoCart(item){
console.log('addIntoCartaddIntoCart',item); console.log('addIntoCartaddIntoCart',item);
mybus.emit('selectCamera', item) mybus.emit('selectCamera', item)
}, },
//
getVideoUrl(data){
let param = data;
getCameraLiveStream(param).then((res) => {
//console.log('555555rrrrr',res)
if(res.data.data){
this.videoUrl = res.data.data.url;
}
//visible.value = true
//options.src = res.data.data
//options.src ="wss://10.134.135.45:6014/proxy/10.10.20.15:559/openUrl/0kIF7La"
})
},
//
handlePrev(){ handlePrev(){
let maxLength = this.cameraDataList.length-1; let maxLength = this.cameraDataList.length-1;
this.defaultIndex = this.defaultIndex - 1;
console.log('opopopop',this.cameraDataList[maxLength]); console.log('opopopop',this.cameraDataList[maxLength]);
if(this.defaultIndex === 0){ if(this.defaultIndex === 0){
this.defaultIndex = maxLength;
console.log('opopopop',this.cameraDataList[maxLength]); console.log('opopopop',this.cameraDataList[maxLength]);
//channelIdurlH5 //channelIdurlH5
//this.videoUrl = //this.videoUrl =
this.getVideoUrl(this.cameraDataList[maxLength]);
} else{ } else{
this.defaultIndex = this.defaultIndex - 1;
console.log('uyutyuyopopopop',this.cameraDataList[this.defaultIndex]); console.log('uyutyuyopopopop',this.cameraDataList[this.defaultIndex]);
this.getVideoUrl(this.cameraDataList[this.defaultIndex]);
} }
}, },
//
handleNext(){ handleNext(){
this.defaultIndex = this.defaultIndex + 1;
if(this.defaultIndex === this.cameraDataList.length){ if(this.defaultIndex === this.cameraDataList.length){
this.defaultIndex = this.cameraDataList.length;
console.log('opopopop',this.cameraDataList[0]); console.log('opopopop',this.cameraDataList[0]);
this.getVideoUrl(this.cameraDataList[0]);
}else{ }else{
this.defaultIndex = this.defaultIndex + 1;
console.log('opopopop',this.cameraDataList[this.defaultIndex]); console.log('opopopop',this.cameraDataList[this.defaultIndex]);
this.getVideoUrl(this.cameraDataList[this.defaultIndex]);
} }
} }

View File

@ -224,6 +224,12 @@ import { ElMessage } from 'element-plus'
this.queryCameraConditionPlace(data) this.queryCameraConditionPlace(data)
}) })
//
mybus.off('clearLeftSelect')
mybus.on('clearLeftSelect', () => {
this.hiMapFun.clearAllLayers();
})
}, },
methods: { methods: {
// //