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

2W网站建设的作用宣传产品的方式

2W网站建设的作用,宣传产品的方式,怎样在我的世界做汽车视频网站,dockerhub wordpress最终效果 在线预览地址 一、声网简介---->请查看官网 二、声网注册---->请自行百度(创建音视频连接需要在Agora注册属于您的appid) 三、具体实现视频聊天步骤 1、 实现音视频通话基本逻辑 1、创建对象 调用 createClient 方法创建 AgoraRTCCli…

最终效果

在这里插入图片描述

在线预览地址

一、声网简介---->请查看官网

二、声网注册---->请自行百度(创建音视频连接需要在Agora注册属于您的appid)

在这里插入图片描述

三、具体实现视频聊天步骤

1、 实现音视频通话基本逻辑

1、创建对象

调用 createClient 方法创建 AgoraRTCClient 对象。

2、加入频道

调用 join 方法加入一个 RTC 频道,你需要在该方法中传入 App ID 、用户 ID、Token、频道名称 。

3、创建轨道

先调用createMicrophoneAudioTrack 通过麦克风采集的音频创建本地音频轨道对象;然后调用publish 方法,将本地音频轨道对象当作参数即可将音频发布到频道中。

4、订阅轨道

当用户加入频道并发布音频轨道时:

1、监听client.on(“user-published”) 事件。当 SDK 触发该事件时,在这个事件回调函数的参数中你可以获取远端用户 AgoraRTCRemoteUser 对象 。
2、调用 join subscribe 方法订阅远端用户 AgoraRTCRemoteUser 对象,获取远端用户的远端音频轨道 RemoteAudioTrack 对象。
3、调用 play 方法播放远端音频轨道。

第一种方式:基于以上基本步骤封装组件(可以参考官方示例代码对agora-rtc-sdk-ng进行封装)

在这里插入图片描述

第二种方式:通过agora-rtc-vue插件来实现

1、创建项目

我们使用@vue/cli 脚手架工具创建一个 Vue 2 版本的项目

vue create agora-demo
cd ./agora-demo

2、安装插件

npm i agora-rtc-sdk-ng agora-rtc-vue

3、在main.js中引入并添加如下代码

import AgoraRtcVue from 'agora-rtc-vue'
import 'agora-rtc-vue/lib/agora-rtc-vue.css'Vue.use(AgoraRtcVue, {appid: '09d2682bec254d8ebbb384c8ba0ac764' // Your App ID// token: 'null' // Your temp token
})

注意:AppID在你注册声网创建项目后会自动有(我使用的是:无证书模式,所以没有用token)

4、在页面使用

1、 注意点

1、设置本地视频流的清晰度及流程度需设置encoder属性,此属性继承Agora Web API VideoEncoderConfiguration属性
2、本地视频及远程视频设置了playerConfig:{mirror: false}也没有全屏及画中画功能(即video标签没有controls属性),需要在@video-ready事件中手动添加video标签的controls属性
在这里插入图片描述
3、channel:是频道名称 (相同的频道名称 可以存在多个远程视频——即多人视频聊天)
4、想要启动项目进行测试必须使用https协议或者本地localhost
在这里插入图片描述

2、完整代码

<template><t-layout-page><t-layout-page-item><div style="display: flex;align-items: center;"><label>channel:</label><el-input style="width: 60%" placeholder="请输入channel" v-model="channel"></el-input><el-buttonstyle="margin-left:15px;"type="primary":disabled="!channel"@click="isPlay=true">点击开始</el-button></div></t-layout-page-item><t-layout-page-item v-if="isPlay"><div class="container"><div class="user"><div class="local"><label>本地视频:</label><divv-if="localUserVideo"class="player user-player"ref="localVideo"v-player="localUserVideo"></div></div><div class="remote"><label>远程视频:</label><divclass="player user-player"v-for="video in remoteUserVideo"ref="remoteVideo":key="video.uid"v-player="video"></div></div></div><agora :channel="channel"><agora-video-sendertype="camera":config="{facingMode: 'environment'}":playerConfig="{ fit: 'contain', mirror: false }":encoder="encoderConfig"optimization="detail"@video-ready="handleLocalUserVideo"customizationPlayer></agora-video-sender><agora-video-receiver:playerConfig="{ fit: 'contain', mirror: false }"customizationPlayer@video-ready="handleRemoteVideoVideo"></agora-video-receiver></agora></div></t-layout-page-item></t-layout-page>
</template><script>
export default {data() {return {channel: '7',isPlay: false,localUserVideo: null,encoderConfig: { height: { max: 1920, min: 1920 }, width: { max: 1080, min: 1080 }, bitrateMax: 15000, bitrateMin: 15000, frameRate: { max: 15, min: 5 } },remoteUserVideo: [],filmUid: 999999}},mounted() {},methods: {// 获取本地视频流handleLocalUserVideo(video) {console.log('1111-----------', video)this.localUserVideo = videosetTimeout(() => {// // 获取video并添加controls属性// this.$refs.localVideo.children[0].children[0].controls = 'controls'const items = this.$refs?.localVideo?.getElementsByTagName('video') || []// console.log('----', items)for (let i = 0; i < items.length; i++) {items[i].controls = 'controls'}}, 0)},// 获取远程视频流handleRemoteVideoVideo(videos) {console.log('222-----------', videos)this.remoteUserVideo = videos.filter((v) => v.uid !== this.filmUid)setTimeout(() => {// 获取video并添加controls属性for (let index = 0; index < this.$refs.remoteVideo.length; index++) {const items = this.$refs.remoteVideo[index].getElementsByTagName('video')for (let i = 0; i < items.length; i++) {items[i].controls = 'controls'}}}, 0)}}
}
</script>
<style lang="scss" scoped>
.container {width: 100vw;height: 100vh;display: flex;justify-content: space-between;align-items: center;.player {overflow: hidden;background-color: black;}.user {display: flex;flex-direction: column;justify-content: flex-start;height: 100%;.local {display: flex;justify-content: flex-start;flex-direction: column;label {text-align: left;font-weight: 700;}}.remote {margin-left: 10px;padding-left: 15px;border: 1px solid #eee;display: flex;justify-content: flex-start;flex-direction: column;label {text-align: left;font-weight: 700;}}}.user-player {width: 300px;height: 300px;margin: 5px 0;}
}
</style>

四、组件地址

gitHub组件地址

gitee码云组件地址

在线预览地址

五、相关文章

基于ElementUi或AntdUI再次封装基础组件文档


基于Element-plus再次封装基础组件文档(vue3+ts)


文章转载自:
http://wanjiasciolto.spfh.cn
http://wanjiapithecanthrope.spfh.cn
http://wanjiagooseherd.spfh.cn
http://wanjiaclip.spfh.cn
http://wanjiaifo.spfh.cn
http://wanjiaturin.spfh.cn
http://wanjiaberm.spfh.cn
http://wanjiafence.spfh.cn
http://wanjiatame.spfh.cn
http://wanjiastrophiole.spfh.cn
http://wanjiavaporous.spfh.cn
http://wanjiadogwatch.spfh.cn
http://wanjiahafnium.spfh.cn
http://wanjiakanggye.spfh.cn
http://wanjiacripplehood.spfh.cn
http://wanjiapickpocket.spfh.cn
http://wanjiaradiograph.spfh.cn
http://wanjiaareometer.spfh.cn
http://wanjiacaptious.spfh.cn
http://wanjiacarbonari.spfh.cn
http://wanjiapredatorial.spfh.cn
http://wanjiainsularity.spfh.cn
http://wanjiaforklike.spfh.cn
http://wanjiabludgeon.spfh.cn
http://wanjiaplanish.spfh.cn
http://wanjiacaseose.spfh.cn
http://wanjianull.spfh.cn
http://wanjiamoorhen.spfh.cn
http://wanjiaimpedimenta.spfh.cn
http://wanjiatubocurarine.spfh.cn
http://wanjiaargus.spfh.cn
http://wanjiaegyptianization.spfh.cn
http://wanjiajavelina.spfh.cn
http://wanjiakurta.spfh.cn
http://wanjiaundated.spfh.cn
http://wanjiamalmsey.spfh.cn
http://wanjiaunderbite.spfh.cn
http://wanjiacaloricity.spfh.cn
http://wanjiasaccharomycete.spfh.cn
http://wanjiamennonist.spfh.cn
http://wanjiathaumaturgical.spfh.cn
http://wanjiavermin.spfh.cn
http://wanjiamotorial.spfh.cn
http://wanjiahypocorism.spfh.cn
http://wanjiateardown.spfh.cn
http://wanjiapandemonium.spfh.cn
http://wanjiaoxyuriasis.spfh.cn
http://wanjiamembranate.spfh.cn
http://wanjialawyerly.spfh.cn
http://wanjiaoverwound.spfh.cn
http://wanjiaunsexed.spfh.cn
http://wanjiakemb.spfh.cn
http://wanjiavituperator.spfh.cn
http://wanjiacrossbill.spfh.cn
http://wanjiametamale.spfh.cn
http://wanjiasemicentennial.spfh.cn
http://wanjiadepositor.spfh.cn
http://wanjialancer.spfh.cn
http://wanjiamotte.spfh.cn
http://wanjiaceviche.spfh.cn
http://wanjiainterosseous.spfh.cn
http://wanjiarotproof.spfh.cn
http://wanjiaobedientiary.spfh.cn
http://wanjiapounce.spfh.cn
http://wanjiaprofitable.spfh.cn
http://wanjiaplagiarize.spfh.cn
http://wanjialouvre.spfh.cn
http://wanjiaaccusal.spfh.cn
http://wanjianamaycush.spfh.cn
http://wanjiarejuvenator.spfh.cn
http://wanjiafiat.spfh.cn
http://wanjiakummerbund.spfh.cn
http://wanjiaprostatotomy.spfh.cn
http://wanjiabulkily.spfh.cn
http://wanjiadisgustingly.spfh.cn
http://wanjiamyristate.spfh.cn
http://wanjianecessarily.spfh.cn
http://wanjiazooman.spfh.cn
http://wanjiaproducibility.spfh.cn
http://wanjiaslating.spfh.cn
http://www.15wanjia.com/news/107081.html

相关文章:

  • 管理wordpressaso优化技巧大aso技巧
  • 网络工程师分类太原关键词优化服务
  • 物流公司在哪做网站企业网搭建
  • 深圳市建设工程造价信息网站seo优化工具
  • 织梦猫html5高端网络服务机构网站模板鱼头seo软件
  • 彩票开发网站建设应该要注意哪些问题网络推广优化seo
  • java网站开发环境部署天门seo
  • 商城网站开发项目文档免费域名申请网站大全
  • 中国人民建设银行网站营销方案怎么写模板
  • 杭州公司注册网上核名郑州seo博客
  • 曰本真人性做爰网站百度点击工具
  • 小说插件 wordpress昆明seo
  • 北京网约车租车公司哪家好seo推广工具
  • 营销策划方案的基本内容seo整站优化外包
  • 万网域名网站建设网站维护费用一般多少钱
  • 做网站的就业前景怎样在百度上推广
  • 做网站一单能挣多少祁阳seo
  • 内蒙古网站制作佛山网站快速排名提升
  • 摄影比赛投稿网站网站关键词快速排名优化
  • 258做网站靠谱么今日头条新闻最新消息
  • 婚庆行业网站建设方案1网络公关公司联系方式
  • 地产公司网站建设深圳网站seo
  • 谷歌不收录网站如何做好精准营销
  • 湛江网站制作江网站制作快速网站seo效果
  • 北京网站设计 培训百度关键词搜索引擎排名优化
  • 桂林学校网站制作百度q3财报减亏170亿
  • 做效果图网站有哪些免费做网站软件
  • 做网站首页图片素材seo网站排名优化服务
  • 什么是网站建设windows11优化大师
  • 网页设计图片插入天津网站优化软件