当前位置: 首页 > news >正文

网站备案那个省份湖北招聘网

网站备案那个省份,湖北招聘网,有哪些推广网站,网站建设执行力一、准备工作 1、海康开放平台H5视频播放器开发包下载 海康开放平台 先注册/登录,然后下载开发包 二、播放视频流 1、引入下载的开发包 在项目中创建文件夹 /static/js/Hk,将下载好的开发包解压放到 Hk 文件夹中, 2、引入 在 index.htm…

一、准备工作

1、海康开放平台H5视频播放器开发包下载

海康开放平台

先注册/登录,然后下载开发包

二、播放视频流

1、引入下载的开发包

在项目中创建文件夹 /static/js/Hk,将下载好的开发包解压放到 Hk 文件夹中,

2、引入

在 index.html 文件中引入

<script src="/static/js/HK/h5player.min.js"></script>

如下图:

3、使用

第一步:// 动态加载 h5player.min.js

// 动态加载 h5player.min.js
function loadh5player() {return new Promise((resolve, reject) => {if (typeof JSPlugin !== "function") {resolve();return;}const script = document.createElement("script");script.src = "/static/js/Hk/h5player.min.js";script.onload = resolve;script.onerror = reject;document.head.appendChild(script);});
}	

第二步:初始化播放窗口

// 初始化播放窗口
playersH5.value = new JSPlugin({szId: "player", //需要英文字母开头 必填szBasePath: "/static/js/Hk/h5player.min.js", // 必填,引用H5player.min.js的js相对路径oStyle: {border: "none",borderSelect: "none",background: "#000",}
})

第二步:播放

function playVideo() {playersH5.value.JS_Play(playerUrl.value, 1);// 事件初始化playersH5.value.JS_SetWindowControlCallback({windowEventSelect: function(iWndIndex) { //插件选中窗口回调console.log('windowSelect callback: ', iWndIndex);},pluginErrorHandler: function(iWndIndex, iErrorCode, oError) { //插件错误回调console.log('pluginError callback: ', iWndIndex, iErrorCode, oError);},windowEventOver: function(iWndIndex) { //鼠标移过回调console.log(iWndIndex);},windowEventOut: function(iWndIndex) { //鼠标移出回调console.log(iWndIndex);},windowEventUp: function(iWndIndex) { //鼠标mouseup事件回调console.log(iWndIndex);},windowFullCcreenChange: function(bFull) { //全屏切换回调console.log('fullScreen callback: ', bFull);},firstFrameDisplay: function(iWndIndex, iWidth, iHeight) { //首帧显示回调console.log('firstFrame loaded callback: ', iWndIndex, iWidth, iHeight);},performanceLack: function(iWndIndex) { //性能不足回调console.log('performanceLack callback: ', iWndIndex);},StreamEnd: function(iWndIndex) { //性能不足回调console.log('recv StreamEnd: ', iWndIndex);},StreamHeadChanged: function(iWndIndex) {console.log('recv StreamHeadChanged: ', iWndIndex);},ThumbnailsEvent: (iWndIndex, eventType, eventCode) => {console.log('recv ThumbnailsEvent: ' + iWndIndex + ", eventType:" + eventType + ", eventCode:" +eventCode);},InterruptStream: (iWndIndex, iTime) => {console.log('recv InterruptStream: ' + iWndIndex + ", iTime:" + iTime);},ElementChanged: (iWndIndex, szElementType) => { //回调采用的是video还是canvas console.log('recv ElementChanged: ' + iWndIndex + ", szElementType:" + szElementType);},});}

三、完整代码

父组件:点击方法跳转到视频播放组件页面

function openVideoPlayBack(item) {uni.navigateTo({url: `/pages/videoPlayback/videoPlayback?url=${item.url}`})
}

子组件videoPlayback.vue:视频播放组件

<template><view class="container"><view class="box" id='player' :style="{'height':heightInfo + 'px'}" :info='playerUrl' :stop='stopPlay'></view><view class="tipName">双击全屏展示</view></view>
</template><script setup>import {ref} from "vue";import {onLoad} from "@dcloudio/uni-app"// 接收页面跳转的传参onLoad((e) => {let {url = null} = e;initPlayers(url)})let playersH5 = ref({}); // 存储播放器实例let heightInfo = ref();//销毁播放窗口状态let stopPlay = ref(false);let playerUrl = ref({})// 初始化播放器async function initPlayers(url) {try {playerUrl.value = url;const systemInfo = uni.getSystemInfoSync(); // 获取系统信息heightInfo.value = (systemInfo.windowHeight)/2;await loadh5player();playersH5.value = new JSPlugin({szId: "player", //需要英文字母开头 必填szBasePath: "/static/js/Hk/h5player.min.js", // 必填,引用H5player.min.js的js相对路径oStyle: {border: "none",borderSelect: "none",background: "#000",}})setTimeout(() => {playVideo()}, 500)} catch (error) {console.error("Failed to initialize JSPlugin:", error);}}function playVideo() {playersH5.value.JS_Play(playerUrl.value, 1);// 事件回调绑定playersH5.value.JS_SetWindowControlCallback({windowEventSelect: function(iWndIndex) { //插件选中窗口回调console.log('windowSelect callback: ', iWndIndex);},pluginErrorHandler: function(iWndIndex, iErrorCode, oError) { //插件错误回调console.log('pluginError callback: ', iWndIndex, iErrorCode, oError);},windowEventOver: function(iWndIndex) { //鼠标移过回调console.log(iWndIndex);},windowEventOut: function(iWndIndex) { //鼠标移出回调console.log(iWndIndex);},windowEventUp: function(iWndIndex) { //鼠标mouseup事件回调console.log(iWndIndex);},windowFullCcreenChange: function(bFull) { //全屏切换回调console.log('fullScreen callback: ', bFull);},firstFrameDisplay: function(iWndIndex, iWidth, iHeight) { //首帧显示回调console.log('firstFrame loaded callback: ', iWndIndex, iWidth, iHeight);},performanceLack: function(iWndIndex) { //性能不足回调console.log('performanceLack callback: ', iWndIndex);},StreamEnd: function(iWndIndex) { //性能不足回调console.log('recv StreamEnd: ', iWndIndex);},StreamHeadChanged: function(iWndIndex) {console.log('recv StreamHeadChanged: ', iWndIndex);},ThumbnailsEvent: (iWndIndex, eventType, eventCode) => {console.log('recv ThumbnailsEvent: ' + iWndIndex + ", eventType:" + eventType + ", eventCode:" +eventCode);},InterruptStream: (iWndIndex, iTime) => {console.log('recv InterruptStream: ' + iWndIndex + ", iTime:" + iTime);},ElementChanged: (iWndIndex, szElementType) => { //回调采用的是video还是canvas console.log('recv ElementChanged: ' + iWndIndex + ", szElementType:" + szElementType);},});}// 动态加载 h5player.min.jsfunction loadh5player() {return new Promise((resolve, reject) => {if (typeof JSPlugin !== "function") {resolve();return;}const script = document.createElement("script");script.src = "/static/js/Hk/h5player.min.js";script.onload = resolve;script.onerror = reject;document.head.appendChild(script);});}
</script><style lang="scss" scoped>.container {width: 100%;height: 600px;display: flex;justify-content: center;align-items: center;flex-direction: column;+// padding-top: 44px;.video-container {width: 100%;}.tipName {margin-top: 10px;color: #3709ee;}}
</style>

http://www.dtcms.com/a/480479.html

相关文章:

  • 如何用txt做网站时增加照片淘宝客网站怎么做
  • wordpress 移动到回收站发生错误wordpress数据库优化技巧
  • 做网站需要理解什么郑州燚空间网络科技有限公司
  • 集团网站建设特点 助君龙华建网站多少钱
  • 大兴安岭网站建设公司中小企业网站建设与推广
  • 网站建设企微商城网站建设价位
  • 洛江网站建设报价关键词优化seo费用
  • 建设银行的网站用户名是什么意思闪闪字体设计网页
  • 怎么做自己的网站后台教程正规的电商平台有哪些
  • 怎么做网页制作网站模板中国最好网站建设公司排名
  • 常州天宁区做网站公司wordpress博客主机选择
  • 河北住房建设厅网站首页北京想象力网站建设
  • 网站刷单账务处理怎么做微页制作网站模板下载软件
  • 资源网站模板coding搭建WordPress
  • 南京市网站建设公司电脑装wordpress
  • 网站网站建设报价建立自己的网站软件有
  • 建站公司见客户没话说魔客吧wordpress主题安装
  • 萧山建设信用网站网络营销传播的核心内容
  • 如何实现网站开发手机验证码中国做网站
  • 北京网站制作公司如何免费建网站赚钱
  • 百度网盘 做网站图床网站做一排横图
  • 中文域名到期对网站的影响ps做网站首页
  • dede怎么设置wap网站建设商务网站的目的
  • 适合做浏览器主页的网站网站服务器怎么迁移
  • 上海建设工程质监局网站天津市哪里有做网站的
  • 网站开发职业定位o2o移动电子商务平台有哪些
  • 上海做网站品牌公司网站源码本地演示
  • php 网站缓存做广个公司网站权重
  • 想让网站被谷歌收录怎么做新开传奇网站发布站
  • 石家庄住房城乡建设厅网站网站域名已经被绑定