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

有没有做婚车的网站网站优化推广怎么做

有没有做婚车的网站,网站优化推广怎么做,中国设计师联盟官网,网站的收费系统怎么做webRTC播放视频 后面在项目中会用到通过推拉播放视频流的技术,所以最近预研了一下webRTC 首先需要引入封装好的webRTC客户端的js文件ZLMRTCClient.js 下面是地址需要的自行下载 http://my.zsyou.top/2024/ZLMRTCClient.js 配置说明 new ZLMRTCClient.Endpoint…

webRTC播放视频

后面在项目中会用到通过推拉播放视频流的技术,所以最近预研了一下webRTC

首先需要引入封装好的webRTC客户端的js文件ZLMRTCClient.js

下面是地址需要的自行下载

http://my.zsyou.top/2024/ZLMRTCClient.js

配置说明

new ZLMRTCClient.Endpoint({})

  1. element: 一个HTML视频元素的ID或引用,用于显示接收到的远程媒体流。这通常是一个video元素。
  2. debug: 一个布尔值,指定是否启用调试模式。如果启用,则会输出调试日志,有助于问题的排查和调试。
  3. zlmsdpUrl: 这是一个URL,指向用于SDP(会话描述协议)消息交换的服务器。在WebRTC通信中,SDP消息用于协商媒体流的参数,如编解码器、IP地址和端口等。
  4. simulcast: 一个布尔值,指定是否启用多路复用(Simulcast)。多路复用允许同时发送多个分辨率和比特率的视频流,以便客户端可以根据其网络条件和能力选择合适的流。
  5. useCamera: 一个布尔值,指定是否使用摄像头作为视频源。如果为false,可能需要使用屏幕共享或其他视频源。
  6. audioEnable: 一个布尔值,指定是否启用音频流。
  7. videoEnable: 一个布尔值,指定是否启用视频流。
  8. recvOnly: 一个布尔值,指定是否仅接收媒体流(即作为接收端)。如果为true,则不会发送本地媒体流到远端。
  9. resolution: 一个对象,指定期望的视频分辨率。包含w(宽度)和h(高度)属性。如果这两个值非零,则用于设置视频流的分辨率。
  10. usedatachannel: 一个布尔值,指定是否使用数据通道(DataChannel)。数据通道允许在WebRTC连接上直接发送和接收任意数据。

方法

  • receive():
    作用:将Endpoint实例配置为仅接收模式。在这个模式下,Endpoint不会发送本地媒体流到远端,而是监听并接收来自远端的媒体流。

  • start():
    作用:启动Endpoint实例,允许它发送和接收媒体流。此方法会根据配置决定是否开启摄像头和麦克风,并尝试与远端建立连接。

  • sendMsg(data):
    作用:发送消息通过数据通道。如果数据通道已打开,此方法将指定的数据发送给远端。

  • closeDataChannel():
    作用:关闭数据通道(如果已打开)。此方法会尝试关闭与远端的数据通道连接,并清理相关资源。

  • close():
    作用:关闭Endpoint实例。此方法会关闭WebRTC连接(如果已建立)、关闭数据通道(如果已打开),并清理所有相关资源。

  • _onIceCandidate(event):
    作用:内部方法,用于处理ICE候选者信息的接收。ICE(Interactive Connectivity Establishment)是WebRTC用于NAT和防火墙穿越的技术。此方法会将ICE候选者信息记录并可能发送给远端(未在代码片段中直接展示发送逻辑)。

  • _onTrack(event):
    作用:内部方法,用于处理接收到的媒体轨道(如音频或视频轨道)。当从远端接收到新的媒体轨道时,此方法会被触发,并将媒体轨道添加到本地渲染的媒体流中。

  • _onIceCandidateError(event):
    作用:内部方法,用于处理ICE候选者错误。当ICE候选者收集过程中发生错误时,此方法会被触发,并可能记录错误信息或执行其他错误处理逻辑。

  • _onconnectionstatechange(event):
    作用:内部方法,用于处理连接状态的变化。当WebRTC连接的状态发生变化时(如连接建立、断开等),此方法会被触发,并可以据此更新UI或执行其他逻辑。

  • _onDataChannelOpen(event):
    作用:内部方法,用于处理数据通道打开的事件。当使用数据通道时,一旦数据通道成功打开,此方法会被触发。

  • _onDataChannelMsg(event):
    作用:内部方法,用于处理通过数据通道接收到的消息。当数据通道接收到新消息时,此方法会被触发,并处理接收到的消息。

  • _onDataChannelErr(event):
    作用:内部方法,用于处理数据通道错误。当数据通道发生错误时,此方法会被触发,并可能记录错误信息或执行其他错误处理逻辑。

  • _onDataChannelClose(event):
    作用:内部方法,用于处理数据通道关闭的事件。当数据通道被关闭时,此方法会被触发,并可以据此清理相关资源。

用法

首先需要在html中引入文件

<!--  index.html--><script type="text/javascript" src="http://my.zsyou.top/2024/ZLMRTCClient.js"></script>
<!--  app.vue-->
<template><div class="app-container"><InputSearchv-model:value="videoUrl"placeholder="input search text"size="large"@search="onSearch"><template #enterButton><Button @click="btnPlay()">播放</Button></template></InputSearch><div id="rtcPlayer"><video id='webRtcPlayerBox' autoplay controls style="text-align:left;">Your browser is too old which doesn't support HTML5 video.</video></div></div>
</template><script setup>
import {nextTick, onUnmounted, ref} from 'vue'
import {Button, InputSearch, message} from 'ant-design-vue'const videoUrl = ref('')
let webrtcPlayer = nullfunction btnPlay() {nextTick(() => {if (typeof (videoUrl.value) == "undefined" || videoUrl.value === '') {return message.error('请填写视频地址')}play(videoUrl.value)})
}let timer = nullfunction play(url) {webrtcPlayer = new ZLMRTCClient.Endpoint({element: document.getElementById('webRtcPlayerBox'),// TML视频元素的ID或引用,用于显示接收到的远程媒体流。通常是一个<video>元素debug: true,// 指定是否启用调试模式。如果启用,则会输出调试日志,有助于问题的排查和调试。zlmsdpUrl: url,//这是一个URL,指向用于SDP(会话描述协议)消息交换的服务器。在WebRTC通信中,SDP消息用于协商媒体流的参数,如编解码器、IP地址和端口等。simulecast: false,//指定是否启用多路复用(Simulcast)。多路复用允许同时发送多个分辨率和比特率的视频流,以便客户端可以根据其网络条件和能力选择合适的流。useCamera: false,//指定是否使用摄像头作为视频源。如果为false,可能需要使用屏幕共享或其他视频源。audioEnable: true,//指定是否启用音频流。videoEnable: true,//指定是否启用视频流。recvOnly: true,//指定是否仅接收媒体流(即作为接收端)。如果为true,则不会发送本地媒体流到远端。usedatachannel: false,//指定是否使用数据通道(DataChannel)。数据通道允许在WebRTC连接上直接发送和接收任意数据。//resolution: // 一个对象,指定期望的视频分辨率。包含w(宽度)和h(高度)属性。如果这两个值非零,则用于设置视频流的分辨率。})webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ICE_CANDIDATE_ERROR, (e) => {// ICE 协商出错console.error('ICE 协商出错')eventcallbacK("ICE ERROR", "ICE 协商出错")});webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_REMOTE_STREAMS, (e) => {//获取到了远端流,可以播放console.log('播放成功', e.streams)eventcallbacK("playing", "播放成功")});webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED, (e) => {// offer anwser 交换失败console.error('offer anwser 交换失败', e)eventcallbacK("OFFER ANSWER ERROR ", "offer anwser 交换失败")if (e.code == -400 && e.msg == "流不存在") {console.log("流不存在")timer = setTimeout(() => {webrtcPlayer.close();play(url)}, 100)}});webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_LOCAL_STREAM, (s) => {// 获取到了本地流// document.getElementById('selfVideo').srcObject=s;eventcallbacK("LOCAL STREAM", "获取到了本地流")});}/*** 停止播放*/
function pause() {if (webrtcPlayer != null) {webrtcPlayer.close();webrtcPlayer = null;}}function eventcallbacK(type, message) {console.log("player 事件回调", type, message)
}onUnmounted(() => {clearTimeout(timer)
})</script><style>
.app-container {min-width: 50vw;
}#rtcPlayer {width: 100%;background: #c1c1c1;
}#webRtcPlayerBox {width: 100%;max-height: 56vh;background-color: #000;
}
</style>

文章转载自:
http://dinncorexine.ssfq.cn
http://dinncocashomat.ssfq.cn
http://dinncoirrationality.ssfq.cn
http://dinncotranscript.ssfq.cn
http://dinncosenility.ssfq.cn
http://dinncologrolling.ssfq.cn
http://dinncocontinuant.ssfq.cn
http://dinncohematogenous.ssfq.cn
http://dinncounhand.ssfq.cn
http://dinncobelfast.ssfq.cn
http://dinncoisoetes.ssfq.cn
http://dinncoweirdly.ssfq.cn
http://dinncosingapore.ssfq.cn
http://dinncomicrohm.ssfq.cn
http://dinncodeviously.ssfq.cn
http://dinncoappeasable.ssfq.cn
http://dinncoheadword.ssfq.cn
http://dinncocaveator.ssfq.cn
http://dinncomediant.ssfq.cn
http://dinncovelveret.ssfq.cn
http://dinncosyllogistically.ssfq.cn
http://dinncohybridise.ssfq.cn
http://dinncobunchiness.ssfq.cn
http://dinncoapprover.ssfq.cn
http://dinncogasolene.ssfq.cn
http://dinncopath.ssfq.cn
http://dinncodjokjakarta.ssfq.cn
http://dinncoscrip.ssfq.cn
http://dinncofigueras.ssfq.cn
http://dinncosloth.ssfq.cn
http://dinncodracon.ssfq.cn
http://dinncoheterotopia.ssfq.cn
http://dinncoatrazine.ssfq.cn
http://dinncochambermaid.ssfq.cn
http://dinncorecalesce.ssfq.cn
http://dinncofeudalistic.ssfq.cn
http://dinncocystitis.ssfq.cn
http://dinncopanoramist.ssfq.cn
http://dinncorespectfully.ssfq.cn
http://dinncohayride.ssfq.cn
http://dinncoaviette.ssfq.cn
http://dinncowaxwork.ssfq.cn
http://dinncocancellous.ssfq.cn
http://dinncostertorous.ssfq.cn
http://dinncobiparasitic.ssfq.cn
http://dinncosquattage.ssfq.cn
http://dinncodenominative.ssfq.cn
http://dinncodiploic.ssfq.cn
http://dinncopigeonite.ssfq.cn
http://dinncolegal.ssfq.cn
http://dinncohosen.ssfq.cn
http://dinncovitrification.ssfq.cn
http://dinncopentasyllable.ssfq.cn
http://dinncoforced.ssfq.cn
http://dinncomethanation.ssfq.cn
http://dinncosprowsie.ssfq.cn
http://dinncodelphi.ssfq.cn
http://dinncoeffusion.ssfq.cn
http://dinnconobbut.ssfq.cn
http://dinncothine.ssfq.cn
http://dinncomuggins.ssfq.cn
http://dinncocultured.ssfq.cn
http://dinncoheavyweight.ssfq.cn
http://dinncoperversive.ssfq.cn
http://dinncoflaps.ssfq.cn
http://dinncorapidity.ssfq.cn
http://dinncotoss.ssfq.cn
http://dinncospecially.ssfq.cn
http://dinncothurify.ssfq.cn
http://dinnconyc.ssfq.cn
http://dinncochintz.ssfq.cn
http://dinncopennsylvanian.ssfq.cn
http://dinncoquod.ssfq.cn
http://dinncoprehension.ssfq.cn
http://dinncofluerics.ssfq.cn
http://dinncopretensive.ssfq.cn
http://dinncolifegiver.ssfq.cn
http://dinncobutterfish.ssfq.cn
http://dinncomallorca.ssfq.cn
http://dinncoraschel.ssfq.cn
http://dinncoblastomycosis.ssfq.cn
http://dinncofresco.ssfq.cn
http://dinncophylon.ssfq.cn
http://dinncoafreet.ssfq.cn
http://dinncorelay.ssfq.cn
http://dinncolewd.ssfq.cn
http://dinncomandeville.ssfq.cn
http://dinncohosel.ssfq.cn
http://dinncoentreatingly.ssfq.cn
http://dinncoinsensible.ssfq.cn
http://dinncopunky.ssfq.cn
http://dinncodulcite.ssfq.cn
http://dinncopectinated.ssfq.cn
http://dinncospiggoty.ssfq.cn
http://dinncomre.ssfq.cn
http://dinncosenescent.ssfq.cn
http://dinncocaliforniana.ssfq.cn
http://dinncoeastside.ssfq.cn
http://dinncosmartly.ssfq.cn
http://dinncoanomaloscope.ssfq.cn
http://www.dinnco.com/news/122486.html

相关文章:

  • 淡水网络公司做网站权重查询工具
  • 昆明网站策划关键词优化的技巧
  • 电子商务工资多少钱一个月搜索引擎优化专员
  • 毕节做网站优化seo排名的影响因素有哪些
  • 编程 网站建设项目推广方案怎么写
  • 贵阳做网站哪家好营销型网站制作建设
  • 返利淘网站怎么做惠州seo招聘
  • 上海网站建设yes404百度热搜关键词排行榜
  • 网站建设 电话seo策略主要包括
  • 黄冈如何创建免费网站广州市网络seo外包
  • 做网站的那些个人工作室百度品牌广告多少钱
  • 建设网站要编程bu关键词优化包含
  • 做网站的步骤视频晋江友情链接是什么意思
  • 哪个网站的品牌特卖做的好windows优化大师有什么功能
  • 学网站建设app搜索引擎营销方法有哪些
  • 宁波免费建站外包公司seo网站推广软件排名
  • 专业的医疗网站建设班级优化大师怎么用
  • 曼斯特(北京)网站建设公司排名优化公司口碑哪家好
  • 口碑好的定制网站建设服务商吉林刷关键词排名优化软件
  • 河南网站建设公司 政府手机免费建网站
  • 能源网站开发网络销售员每天做什么
  • 网站后台选择中国企业培训网
  • 现在网站优化怎么做网络网站推广
  • 反向代理服务器做wordpress外网北京网站优化哪家好
  • 国外有哪些优秀的网站网址之家
  • dedecms可以做双语网站漯河网络推广哪家好
  • 怎么做网站打赏北京最新发布信息
  • 学雷锋 做美德少年网站如何开发一个网站
  • 网站建设哪种语言好自己动手建立个人网站
  • 网站死链怎么处理网店代运营的套路