|
@@ -16,6 +16,8 @@ type VideoStatus = 'init' | 'stream' | 'liveing' | 'stopped' | 'error' | 'loadin
|
|
|
|
|
|
export type TrackType = 'microphone' | 'camera' | 'screen'
|
|
|
|
|
|
+let publishError = false
|
|
|
+
|
|
|
type ActiveTracks = {
|
|
|
[key in TrackType]: RTC.RCLocalTrack | null
|
|
|
}
|
|
@@ -411,7 +413,22 @@ export const setTrack = async (tracks: RTC.RCLocalTrack[], trackType: TrackType,
|
|
|
console.log(needPublish)
|
|
|
if (needPublish) {
|
|
|
// console.log('publish', runtime.joinedRoom)
|
|
|
- await runtime.joinedRoom?.publish(tracks.filter(track => !!track))
|
|
|
+ try {
|
|
|
+ const res = await runtime.joinedRoom?.publish(tracks.filter(track => !!track))
|
|
|
+ console.log(res, 'pub')
|
|
|
+ if(res?.code !== RTC.RCRTCCode.SUCCESS && !publishError) {
|
|
|
+ publishError = true
|
|
|
+ window.onbeforeunload = null
|
|
|
+ ElMessageBox.alert('视频就发送失败,请刷新页面重新开启?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ callback: () => {
|
|
|
+ publishError = false
|
|
|
+ window.location.reload()
|
|
|
+ }})
|
|
|
+ }
|
|
|
+ } catch(err: any) {
|
|
|
+ console.log(err, 'err')
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
/**
|