Merge branch 'master' of http://git.luyuan.tk/luyuan/beelink into zj
This commit is contained in:
commit
a7415989ce
@ -9,7 +9,7 @@
|
|||||||
<div class="top">
|
<div class="top">
|
||||||
<div class="left">直播页面</div>
|
<div class="left">直播页面</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<img src="@/static/images/liveshare.png" alt="" @click="fenxiang()" />
|
<img src="@/static/images/liveshare.png" alt="" @click="qiehuan()" />
|
||||||
<img src="@/static/images/liveend.png" alt="" />
|
<img src="@/static/images/liveend.png" alt="" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -36,10 +36,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="others">
|
<div class="others">
|
||||||
<div class="othersitem">
|
<div id="s-10" class="othersitem">
|
||||||
<div class="watcher"></div>
|
<div class="watcher"></div>
|
||||||
<div class="name">asdsada</div>
|
<div class="name">asdsada</div>
|
||||||
<img src="" alt="" />
|
<!-- <img src="" alt="" /> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="othersitem">
|
<div class="othersitem">
|
||||||
<div class="watcher"></div>
|
<div class="watcher"></div>
|
||||||
@ -204,7 +204,30 @@ export default defineComponent({
|
|||||||
let localStream: any;
|
let localStream: any;
|
||||||
let statie = true;
|
let statie = true;
|
||||||
let userSing = '';
|
let userSing = '';
|
||||||
function pingmu(){
|
let type = false;
|
||||||
|
async function qiehuan(){
|
||||||
|
// 1 屏幕分享 2 摄像头
|
||||||
|
client.unpublish(localStream)
|
||||||
|
localStream = type ? TRTC.createStream({ userid: 10, audio: true, screen: true }) : TRTC.createStream({ userId: 10, audio: true, video: true });
|
||||||
|
type = !type;
|
||||||
|
localStream.initialize().then(()=>{
|
||||||
|
client
|
||||||
|
.publish(localStream)
|
||||||
|
.catch((error: string) => {
|
||||||
|
console.error('本地流发布失败 ' + error);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
const el = document.querySelector("#local_stream");
|
||||||
|
if(el){
|
||||||
|
el.innerHTML = ""
|
||||||
|
}
|
||||||
|
localStream.play('local_stream');
|
||||||
|
console.log('本地流发布成功');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
function pingmu(){
|
||||||
localStream = TRTC.createStream({ userid: 10, audio: true, screen: true });
|
localStream = TRTC.createStream({ userid: 10, audio: true, screen: true });
|
||||||
|
|
||||||
localStream
|
localStream
|
||||||
@ -255,7 +278,19 @@ export default defineComponent({
|
|||||||
mode: 'rtc',
|
mode: 'rtc',
|
||||||
sdkAppId: '1400400340',
|
sdkAppId: '1400400340',
|
||||||
userId: 10,
|
userId: 10,
|
||||||
userSig: userSig
|
userSig: 'eJw1zMsKwjAUBNB-yVrqzatowaU7UcQgGNxEG5tLUGNSxQf*u7FWmM2cgXkRNVsVNxtJRVgBZNB1rO2pxQN2TP*aam9CwJpUVADkcAG-xd4DRptdSskAem3x*LUSOOdjoL0mbPLpvtx5rRbb4RIla86XBxNGKTePI391T64N6jQFgRu3ThPy-gBYczBk'
|
||||||
|
});
|
||||||
|
client.on('stream-added', (event: { stream: any }) => {
|
||||||
|
const remoteStream = event.stream;
|
||||||
|
console.log('远端流增加: ' + remoteStream.getId());
|
||||||
|
//订阅远端流
|
||||||
|
client.subscribe(remoteStream);
|
||||||
|
});
|
||||||
|
client.on('stream-subscribed', (event: { stream: any }) => {
|
||||||
|
const remoteStream = event.stream;
|
||||||
|
console.log('远端流订阅成功:' + remoteStream.getId());
|
||||||
|
// 播放远端流
|
||||||
|
remoteStream.play('s-' + remoteStream.getId());
|
||||||
});
|
});
|
||||||
client
|
client
|
||||||
.join({ roomId: 11 })
|
.join({ roomId: 11 })
|
||||||
@ -293,7 +328,8 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
|
|
||||||
return{
|
return{
|
||||||
fenxiang
|
fenxiang,
|
||||||
|
qiehuan
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user