Merge branch 'master' of http://git.luyuan.tk/luyuan/beelink into zj

This commit is contained in:
asd 2020-10-23 09:01:33 +08:00
commit a7415989ce

View File

@ -9,7 +9,7 @@
<div class="top">
<div class="left">直播页面</div>
<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="" />
</div>
</div>
@ -36,10 +36,10 @@
</div>
</div>
<div class="others">
<div class="othersitem">
<div class="watcher"></div>
<div class="name">asdsada</div>
<img src="" alt="" />
<div id="s-10" class="othersitem">
<div class="watcher"></div>
<div class="name">asdsada</div>
<!-- <img src="" alt="" /> -->
</div>
<div class="othersitem">
<div class="watcher"></div>
@ -204,7 +204,30 @@ export default defineComponent({
let localStream: any;
let statie = true;
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
@ -255,7 +278,19 @@ export default defineComponent({
mode: 'rtc',
sdkAppId: '1400400340',
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
.join({ roomId: 11 })
@ -293,7 +328,8 @@ export default defineComponent({
})
return{
fenxiang
fenxiang,
qiehuan
}
},
});