MediaStream使用webRtc多窗口传递

最近在做音视频通话,有个需求是把当前会话弄到另一个窗口单独展示,但是会话是属于主窗口的,多窗口通信目前不能直接传递对象,所以想着使用webRtc在主窗口和兄弟窗口建立连接,把主窗口建立会话得到的MediaStream传递给兄弟窗口;

主窗口界面

在这里插入图片描述

兄弟窗口界面

在这里插入图片描述

主窗口点击发送本地媒体后

在这里插入图片描述

呼叫封装_主窗口
// 主窗口WebRtc_呼叫
class CallWindowWebRtc {// 广播通道curBroadcas: BroadcastChannel;// webRtc点对点连接peerConnection: RTCPeerConnection;// 广播通道constructor({broadcastChannelName = 'yyh_text'}) {this.curBroadcas = CreateBroadcastChannel(broadcastChannelName);this.curBroadcas.onmessage = (event) => this.onMessage(event);// 处理页面刷新和关闭方法this.handlePageRefreshClose();}// 接收消息onMessage(event: any) {const msg = event.data;// 收到远端接听消息if (msg.type === 'answer') {this.handleSedRemoteSDP(msg);}if (msg.type === 'hangup') {this.hangup();}}// 发送消息_方法postMessage(msg: any) {this.curBroadcas.postMessage(msg);}// 处理页面刷新和关闭方法handlePageRefreshClose() {window.addEventListener('beforeunload', () => {this.postMessage({data: {event: 'mainPageRefresh', eventName: '主页面刷新了'}});});window.addEventListener('beforeunload', () => {this.postMessage({data: {event: 'mainPageClose', eventName: '主页面关闭了'}});});}// 处理媒体停止handleStreamStop() {if (!this.peerConnection) { return; }let localStream = this.peerConnection.getSenders();localStream.forEach((item: any) => {item.track.stop();})}// 卸载unmount() {if (this.peerConnection) {let localStream = this.peerConnection.getSenders();localStream.forEach((item: any) => {item.track.stop();})this.peerConnection.close();this.peerConnection.onicecandidate = null;this.peerConnection.ontrack = null;this.peerConnection.oniceconnectionstatechange = null;this.peerConnection = null;}if (this.curBroadcas) {this.curBroadcas.onmessage = null;this.curBroadcas = null;}}// ICE连接状态回调handleOniceconnectionstatechange(event) {// 1.检查网络配置if (this.peerConnection.iceConnectionState === 'checking') {// 发送订阅消息_给外部this.onSubscriptionMsg({event: 'iceConnectionState', code: 'checking', eventName: '检查网络配置'});// 2.ICE候选者被交换并成功建立了数据传输通道} else if (this.peerConnection.iceConnectionState === 'connected') {// 发送订阅消息_给外部this.onSubscriptionMsg({event: 'iceConnectionState', code: 'connected', eventName: 'ICE候选者被交换并成功建立了数据传输通道'});// 3.当连接被关闭或由于某种原因(如网络故障、对端关闭连接等)中断时} else if (this.peerConnection.iceConnectionState === 'disconnected') {this.hangup();this.onSubscriptionMsg({event: 'iceConnectionState', code: 'connected', eventName: 'ICE接被关闭或由于某种原因断开'});};}// 发送订阅消息给外部onSubscriptionMsg(msg: {}) {}// 创建全新的 RTCPeerConnectionhandleCreateNewPerrc() {// 停止媒体 this.handleStreamStop();// 最好每一次通话都单独创建一个RTCPeerConnection对象,防止复用导致ICE候选的收集受到之前连接的影响,导致画面延迟加载,或其它异常问题无法排查处理;this.peerConnection = new RTCPeerConnection();this.peerConnection.onicecandidate = (event) => this.onIcecandidate(event);this.peerConnection.ontrack = (event) => this.handleOnTrack(event);this.peerConnection.oniceconnectionstatechange  = (event) => this.handleOniceconnectionstatechange(event);}// 呼叫call(stream?: MediaStream) {return new Promise((resolve, reject) => {this.handleCreateNewPerrc();this.handleStreamAddPeerConnection(stream);this.handleCreateOffer().then((offer) => {// 存入本地offerthis.handleLocalDes(offer).then(() => {// 给远端发sdpthis.handleSendSDP();resolve({code: 1, message: '发送sdp给远端'});}).catch(() => {reject({code: 0, message: '存入本地offer失败'});});}).catch(() => {reject({code: 0, message: '创建offer失败'});});});}// 挂断hangup() {if (!this.peerConnection) {return;}if (this.peerConnection.signalingState === 'closed') {return;};this.postMessage({type: 'hangup'});// 停止媒体流let localStream = this.peerConnection.getSenders();localStream.forEach((item: any) => {item.track.stop();});// 关闭peerConectionthis.peerConnection.close();}// 1.获取本地媒体流getUserMediaToStream(audio: true, video: true) {return navigator.mediaDevices.getUserMedia({audio, video});}// 2.把媒体流轨道添加到 this.peerConnection 中handleStreamAddPeerConnection(stream?: MediaStream) {if (!stream) {stream = new MediaStream();}const tmpStream = new MediaStream();const audioTracks = stream.getAudioTracks();const videoTracks = stream.getVideoTracks();if (audioTracks.length) {tmpStream.addTrack(audioTracks[0]);this.peerConnection.addTrack(tmpStream.getAudioTracks()[0], tmpStream);}if (videoTracks.length) {tmpStream.addTrack(videoTracks[0]);this.peerConnection.addTrack(tmpStream.getVideoTracks()[0], tmpStream);}}// 3.创建createOfferhandleCreateOffer() {return this.peerConnection.createOffer();}// 4.设置本地SDP描述handleLocalDes(offer) {return this.peerConnection.setLocalDescription(offer);}// 5.发送SDP消息给远端handleSendSDP() {if (this.peerConnection.signalingState === 'have-local-offer') {// 使用某种方式将offer传递给窗口Bconst answerData = {type: this.peerConnection.localDescription.type,sdp: this.peerConnection.localDescription.sdp};this.curBroadcas.postMessage(answerData);}}// 6.收到远端接听_存远端SDPhandleSedRemoteSDP(msg: any) {// if (this.peerConnection.signalingState === 'stable') { return; }const answerData = msg;const answer = new RTCSessionDescription(answerData);return this.peerConnection.setRemoteDescription(answer);}// 7.用于处理ICEonIcecandidate(event) {// 如果event.candidate存在,说明有一个新的ICE候选地址产生了if (event.candidate) {  // 将ICE候选地址, 通常需要通过信令服务器发送给对端this.curBroadcas.postMessage({type: 'candidate', candidate: JSON.stringify(event.candidate)});  } else {  // 如果event.candidate不存在,则表示所有候选地址都已经收集完毕// 在某些情况下,这可能意味着ICE候选过程已完成,但并非总是如此// 因为在某些情况下,会有多轮ICE候选生成}}// 8.监听轨道赋值给video标签onTrackhandleOnTrack(event: any) {let remoteStream = event.streams[0];// 发送订阅消息_给外部this.onSubscriptionMsg({event: 'remoteStreams', eventName: '远端视频准备好了', remoteStream})}}
兄弟窗口封装
// 其它窗口WebRtc_接听
class AnswerWindowWebRtc {// 广播通道curBroadcas: BroadcastChannel;// webRtc点对点连接peerConnection: RTCPeerConnection;constructor({broadcastChannelName = 'yyh_text'}) {this.curBroadcas = CreateBroadcastChannel(broadcastChannelName);this.curBroadcas.onmessage = (event) => this.onMessage(event);this.handlePageRefreshClose();}// 接收消息onMessage(event: any) {const msg = event.data;// 收到远端SDPif (msg.type === 'offer') {this.handleCreateNewPerrc();this.onSubscriptionMsg({event: 'incomingCall', eventName: '收到新的来电', offer: msg});}// 保存这些 candidate,candidate 信息主要包括 IP 和端口号,以及所采用的协议类型等if (msg.type === 'candidate') {const candidate = new RTCIceCandidate(JSON.parse(event.data.candidate));this.peerConnection.addIceCandidate(candidate);}if (msg.type === 'hangup') {this.hangup();}}// 发送消息_方法postMessage(msg: any) {this.curBroadcas.postMessage(msg);}// 收到来电后创建全新的handleCreateNewPerrc() {// 停止媒体this.handleStreamStop();// 最好每一次通话都单独创建一个RTCPeerConnection对象,防止复用导致ICE候选的收集受到之前连接的影响,导致画面延迟加载,或其它异常问题无法排查处理;this.peerConnection = new RTCPeerConnection();this.peerConnection.ontrack = (event) => this.handleOnTrack(event);this.peerConnection.oniceconnectionstatechange  = (event) => this.handleOniceconnectionstatechange();}// 处理页面刷新和关闭方法handlePageRefreshClose() {window.addEventListener('beforeunload', () => {this.postMessage({data: {event: 'otherPageRefresh', eventName: '其它页面刷新了'}});});window.addEventListener('beforeunload', () => {this.postMessage({data: {event: 'otherPageClose', eventName: '其它页面关闭了'}});});}// 处理媒体停止handleStreamStop() {if (!this.peerConnection) { return; }let localStream = this.peerConnection.getSenders();localStream.forEach((item: any) => {item.track.stop();})}// 卸载unmount() {if (this.peerConnection) {let localStream = this.peerConnection.getSenders();localStream.forEach((item: any) => {item.track.stop();})this.peerConnection.close();this.peerConnection.onicecandidate = null;this.peerConnection.ontrack = null;this.peerConnection.oniceconnectionstatechange = null;this.peerConnection = null;}if (this.curBroadcas) {this.curBroadcas.onmessage = null;this.curBroadcas = null;}}// 挂断hangup() {if (!this.peerConnection) {return;}if (this.peerConnection.signalingState === 'closed') {return;};this.postMessage({type: 'hangup'});// 停止媒体流let localStream = this.peerConnection.getSenders();localStream.forEach((item: any) => {item.track.stop();});// 关闭peerConectionthis.peerConnection.close();}// ICE连接状态回调handleOniceconnectionstatechange() {// 1.检查网络配置if (this.peerConnection.iceConnectionState === 'checking') {// 发送订阅消息_给外部this.onSubscriptionMsg({event: 'iceConnectionState', code: 'checking', eventName: '检查网络配置'});// 2.ICE候选者被交换并成功建立了数据传输通道} else if (this.peerConnection.iceConnectionState === 'connected') {// 发送订阅消息_给外部this.onSubscriptionMsg({event: 'iceConnectionState', code: 'connected', eventName: 'ICE候选者被交换并成功建立了数据传输通道'});// 3.当连接被关闭或由于某种原因(如网络故障、对端关闭连接等)中断时} else if (this.peerConnection.iceConnectionState === 'disconnected') {this.hangup();this.onSubscriptionMsg({event: 'iceConnectionState', code: 'connected', eventName: 'ICE接被关闭或由于某种原因断开'});};}// 发送订阅消息给外部onSubscriptionMsg(msg: {}) {}// 接听answer(msg: any, stream?: MediaStream) {return new Promise((resolve, reject) => {this.handleStreamAddPeerConnection(stream);this.handleSedRemoteSDP(msg).then(() => {this.handleCreateAnswer().then((offer) => {this.handleLocalDes(offer).then(() => {this.handleSendAnswerRemoteMsg();resolve({code: 1, message: '已发送接听消息给发送端,等待ice确认'});}).catch(() => {reject({code: 0, message: '本地sdp存储失败'});});}).catch(() => {reject({code: 0, message: '创建接听offer失败'});});}).catch(() => {reject({code: 0, message: '远端sdp存储失败'});})});}// 1.获取本地媒体流getUserMediaToStream(audio: true, video: true) {return navigator.mediaDevices.getUserMedia({audio, video});}// 2.把媒体流轨道添加到 this.peerConnection 中handleStreamAddPeerConnection(stream?: MediaStream) {if (!stream) {stream = new MediaStream();}const tmpStream = new MediaStream();const audioTracks = stream.getAudioTracks();const videoTracks = stream.getVideoTracks();if (audioTracks.length) {tmpStream.addTrack(audioTracks[0]);this.peerConnection.addTrack(tmpStream.getAudioTracks()[0], tmpStream);}if (videoTracks.length) {tmpStream.addTrack(videoTracks[0]);this.peerConnection.addTrack(tmpStream.getVideoTracks()[0], tmpStream);}}// 3.收到远端邀请_存远端SDPhandleSedRemoteSDP(msg: any) {const answerData = msg;const answer = new RTCSessionDescription(answerData);return this.peerConnection.setRemoteDescription(answer);}// 4.接听handleCreateAnswer() {return this.peerConnection.createAnswer();}// 5.设置本地SDP描述handleLocalDes(offer) {return this.peerConnection.setLocalDescription(offer);}// 6.发送接听消息给远端handleSendAnswerRemoteMsg() {const answerData = {type: this.peerConnection.localDescription.type,sdp: this.peerConnection.localDescription.sdp};// 使用某种方式将answer传递回窗口Athis.curBroadcas.postMessage(answerData);}// 7.监听轨道赋值给video标签onTrackhandleOnTrack(event: any) {let remoteStream = event.streams[0];// 发送订阅消息_给外部this.onSubscriptionMsg({event: 'remoteStreams', eventName: '远端视频准备好了', remoteStream})}
}
导出方法
// 创建广播通道_建立两个窗口的广播通道,方便互发消息
function CreateBroadcastChannel(channelName: string) {return new BroadcastChannel(channelName);
};
export {CallWindowWebRtc, AnswerWindowWebRtc};
vue3主窗口使用
<template><div class="root"><h1>主窗口</h1><div class="loca_right_parent_wrap"><div class="loca_video_wrap"><div><button @click="methods.handleVideoToTracks()">发送本地视频给兄弟窗口</button></div><video id="locaVideo" autoplay controls src="./one.mp4" loop width="640" height="480" muted></video></div><div class="remote_video_wrap"><div class="tip_text">兄弟窗口视频预览 <button @click="methods.handleHangUp()">挂断</button> </div><video id="remoteVideo" autoplay controls width="640" height="480"></video></div></div></div>
</template><script lang="ts">
import {onMounted, onBeforeUnmount} from 'vue';
import {CallWindowWebRtc} from '@/Util/MultiWindowSharingStream';
let curWebRtc: any = null;
export default {setup() {const methods = {handleVideoToTracks() {if (curWebRtc) {curWebRtc.unmount && curWebRtc.unmount();}curWebRtc = new CallWindowWebRtc({});// 获取轨道const myVideo = document.getElementById('locaVideo');const myVideoStream = (myVideo as any).captureStream(30);// 呼叫curWebRtc.call(myVideoStream);// 拦截订阅消息curWebRtc.onSubscriptionMsg = (msg) => {if (msg.event && msg.event === 'remoteStreams') {const {remoteStream} = msg;const remoteRef = document.getElementById('remoteVideo');(remoteRef as HTMLVideoElement).srcObject = remoteStream;// (remoteRef as HTMLVideoElement).play();}}},handleHangUp() {if (curWebRtc) {curWebRtc.hangup && curWebRtc.hangup();}},// 处理组件卸载handleUnmount(){if (curWebRtc) {curWebRtc.unmount && curWebRtc.unmount();}}}onMounted(() => {});onBeforeUnmount(() => {methods.handleUnmount();})return {methods,}}
}
</script><style lang="scss" scoped>
.root{.loca_right_parent_wrap{display: flex;}.loca_video_wrap{box-sizing: border-box;padding: 0 5px;video{background: #000;}}.remote_video_wrap{box-sizing: border-box;padding: 0 5px;.tip_text{height: 28px;}video{background: #000;}}
}
</style>
vue3兄弟窗口使用
<template><div class="root"><h1>兄弟窗口</h1><div class="loca_right_parent_wrap"><div class="loca_video_wrap"><div class="tip_text">本地视频预览</div><video id="locaVideo" autoplay controls src="./two.mp4" loop width="640" height="480"></video></div><div class="remote_video_wrap"><div class="tip_text">主窗口视频预览 <button @click="methods.handleHangUp()">挂断</button></div><video id="remoteVideo" autoplay controls width="640" height="480"></video></div></div></div>
</template><script lang="ts">
import {onMounted, onBeforeUnmount} from 'vue';
import {AnswerWindowWebRtc} from '@/Util/MultiWindowSharingStream';
let curWebRtc: any = null;
export default {setup() {const methods = {handleVideoToTracks() {},handleInitAnswerOne() {if (curWebRtc) {curWebRtc.close && curWebRtc.close();curWebRtc = null;}curWebRtc = new AnswerWindowWebRtc({});const remoteRef = document.getElementById('remoteVideo');const myVideo = document.getElementById('locaVideo');// 拦截订阅消息curWebRtc.onSubscriptionMsg = (msg) => {// 收到远端媒体流if (msg.event && msg.event === 'remoteStreams') {const {remoteStream} = msg;const remoteRef = document.getElementById('remoteVideo');(remoteRef as HTMLVideoElement).srcObject = remoteStream;// (remoteRef as HTMLVideoElement).play();}// 收到新的来电if (msg.event && msg.event === 'incomingCall') {(remoteRef as HTMLVideoElement).srcObject = null;// 获取轨道const locaVideoStream = (myVideo as any).captureStream(30);const {offer} = msg;curWebRtc.answer(offer, locaVideoStream);}}},handleHangUp() {if (curWebRtc) {curWebRtc.hangup && curWebRtc.hangup();}},handleUnmount() {if (curWebRtc) {curWebRtc.unmount && curWebRtc.unmount();curWebRtc = null;}}}onMounted(() => {methods.handleInitAnswerOne();});onBeforeUnmount(() => {methods.handleUnmount();});return {methods}}
}
</script><style lang="scss" scoped>
.root{.loca_right_parent_wrap{display: flex;}.loca_video_wrap{box-sizing: border-box;padding: 0 5px;.tip_text{height: 28px;}video{background: #000;}}.remote_video_wrap{box-sizing: border-box;padding: 0 5px;.tip_text{height: 28px;}video{background: #000;}}
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/824610.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Unity之XR Interaction Toolkit如何在VR中实现渐变黑屏效果

前言 做VR的时候,有时会有跳转场景,切换位置,切换环境,切换进度等等需求,此时相机的画面如果不切换个黑屏,总会感觉很突兀。刚好Unity的XR Interaction Toolkit插件在2.5.x版本,出了一个TunnelingVignette的效果,我们今天就来分析一下他是如何使用的,然后我们自己再来…

MAC电脑M1安装OpenCV

最近在学习研究OpenCV&#xff0c;奈何只有mac电脑。安装OpenCV感觉还是挺麻烦的&#xff0c;所以记录一下&#xff0c;难免以后会忘记。 安装OpenCV我参考的帖子 https://www.bilibili.com/read/cv23613225/ 一、首先安装Anaconda 目前已安装不做赘述 二、启动命令窗口 方…

ArcGIS无法链接在线地图或错误: 代理服务器从远程服务器收到了错误地址(验证服务器是否正在运行)。

这几天我们分享了&#xff01; 谷歌卫星影像图归来&#xff01;ArcGIS直连&#xff01;快来获取_谷歌影像lyr-CSDN博客文章浏览阅读666次&#xff0c;点赞11次&#xff0c;收藏9次。大概。_谷歌影像lyrhttps://blog.csdn.net/kinghxj/article/details/137521877一套图源搞定&a…

【办公类-22-04】20240418 UIBOT模拟上传每天两篇,获取流量券,并删除内容

背景需求&#xff1a; 前文制作了用UIBOT获取CSCN的3天、5天、7天、12天奖励流量券&#xff0c; 【办公类-22-03】20240417 UIBOT模拟上传获取流量券&#xff0c;并删除内容-CSDN博客文章浏览阅读253次&#xff0c;点赞6次&#xff0c;收藏3次。【办公类-22-03】20240417 UIB…

详解运算符重载,赋值运算符重载,++运算符重载

目录 前言 运算符重载 概念 目的 写法 调用 注意事项 详解注意事项 运算符重载成全局性的弊端 类中隐含的this指针 赋值运算符重载 赋值运算符重载格式 注意点 明晰赋值运算符重载函数的调用 连续赋值 传引用与传值返回 默认赋值运算符重载 前置和后置重载 前…

华为OD机试 - 分披萨 - 动态规划(Java 2024 C卷 200分)

华为OD机试 2024C卷题库疯狂收录中&#xff0c;刷题点这里 专栏导读 本专栏收录于《华为OD机试&#xff08;JAVA&#xff09;真题&#xff08;A卷B卷C卷&#xff09;》。 刷的越多&#xff0c;抽中的概率越大&#xff0c;每一题都有详细的答题思路、详细的代码注释、样例测试…

抖去推短视频矩阵系统----源头开发

为什么一直说让企业去做短视频矩阵&#xff1f;而好处就是有更多的流量入口&#xff0c;不同平台或账号之间可以进行资源互换&#xff0c;最终目的就是获客留咨&#xff0c;提单转化。你去看一些做得大的账号&#xff0c;你会发现他们在许多大的平台上&#xff0c;都有自己的账…

HTML5 <video> 标签属性、API 方法、事件、自定义样式详解与实用示例

HTML5 <video> 标签为网页内嵌视频提供了强大且便捷的功能。以下是对 <video> 标签的主要属性、API 方法、事件、自定义样式及其使用示例的详细介绍&#xff1a; 一、属性 1. src 定义&#xff1a;指定视频文件的 URL。示例&#xff1a;<video src"my_v…

【C++杂货铺】继承

目录 &#x1f308;前言&#x1f308; &#x1f4c1; 继承的概念和定义 &#x1f4c2; 概念 &#x1f4c2; 定义 &#x1f4c1; 基类和派生类对象赋值转换 &#x1f4c1; 继承中的作用域 &#x1f4c1; 派生类的默认成员函数 构造函数 析构函数 拷贝构造函数 赋值重载…

有公网IP,如何设置端口映射实现访问?

很多中小型公司或个人会根据自身需求自建服务器&#xff0c;或者将自己内网的服务、应用发布到外网&#xff0c;实现异地访问&#xff0c;如远程桌面、网站、数据库、公司的管理系统、FTP、管家婆、监控系统等等。 没接触过的人可能会觉得这个很难&#xff0c;实际上使用快解析…

Golang插件系统实现

插件可以在解耦的基础上灵活扩展应用功能&#xff0c;本文介绍了如何基于Golang标准库实现插件功能&#xff0c;帮助我们构建更灵活可扩展的应用。原文: Plugins with Go 什么是插件 简单来说&#xff0c;插件就是可以被其他软件加载的软件&#xff0c;通常用于扩展应用程序的功…

[入门]测试层级-ApiHug准备-测试篇-005

&#x1f917; ApiHug {Postman|Swagger|Api...} 快↑ 准√ 省↓ GitHub - apihug/apihug.com: All abou the Apihug apihug.com: 有爱&#xff0c;有温度&#xff0c;有质量&#xff0c;有信任ApiHug - API design Copilot - IntelliJ IDEs Plugin | Marketplace 这里的测…

学习STM32第十五天

SPI外设 一、简介 STM32F4XX内部集成硬件SPI收发电路&#xff0c;可以由硬件自动执行时钟生成、数据收发等功能&#xff0c;减轻CPU负担&#xff0c;可配置8位/16位数据帧&#xff0c;高位&#xff08;最常用&#xff09;/低位先行&#xff0c;三组SPI接口&#xff0c;支持DMA…

第一篇【传奇开心果系列】我和AI面对面聊编程:深度比较PyQt5和tkinter.ttk

传奇开心果系列博文 系列博文目录我和AI面对面聊编程系列 博文目录前言一、今天我们面对广大读者选择PyQt5和tkinter.ttk做比较这个话题目的是什么&#xff1f;二、举一个最简单的pyqt5信号和插槽的例子三、这和tkinter的点击事件有什么区别&#xff1f;四、如何选择&#xff1…

MySQL Explan执行计划详解

Explan执行计划 首先我们采用explan执行计划 执行一条sql&#xff0c;发现返回了12个列&#xff0c;下面会详细解释每一列 1、ID列 id列的值是代表了select语句执行顺序&#xff0c;是和select相关联的&#xff1b;id列的值大的会优先执行&#xff0c;如果id列为空最后执行&a…

数据库的创建

数据库分类 通过查看对象资源管理器来区分数据库类型 数据库物理文件的组成 : 数据库文件 日志文件 创建一个主数据文件和一个日志文件

上线流程及操作

上节回顾 1 搜索功能-前端&#xff1a;搜索框&#xff0c;搜索结果页面-后端&#xff1a;一种类型课程-APIResponse(actual_courseres.data.get(results),free_course[],light_course[])-搜索&#xff0c;如果数据量很大&#xff0c;直接使用mysql&#xff0c;效率非常低--》E…

淘宝商品数据抓取新策略:API接口助力获取标题、分类与店铺名

随着电子商务的迅猛发展&#xff0c;淘宝作为中国最大的网络购物平台&#xff0c;其商品数据对于众多商家、研究者和市场分析师来说具有极高的价值。然而&#xff0c;如何高效、准确地抓取淘宝商品数据&#xff0c;尤其是商品标题、分类和店铺名等关键信息&#xff0c;一直是一…

nginx部署上线

1. windows配置nginx 打包命令 npm run build:prod 1. 安装 nginx mac windows 2. mac / windows 环境下ngnix部署启动项目 2. nginx 解决 history 的 404 问题 3. nginx配置代理解决生产环境跨域问题

极速、易用、高度定制化的开源社区交流平台:Flarum

Flarum&#xff1a;轻盈高效&#xff0c;引领未来社区互动新风尚的革命性论坛平台- 精选真开源&#xff0c;释放新价值。 概览 Flarum是一款精心打造的现代网站讨论平台&#xff0c;以其精炼高效而著称。作为 esoTalk 和 FluxBB 的理念和技术的集大成者&#xff0c;Flarum 致力…