|  | @@ -10,7 +10,6 @@ let rtc;
 | 
	
		
			
				|  |  |   * @returns { object }
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  export function initSDK(data) {
 | 
	
		
			
				|  |  | -  // eslint-disable-next-line no-undef
 | 
	
		
			
				|  |  |    rtc = new Rtc(data);
 | 
	
		
			
				|  |  |    return rtc;
 | 
	
		
			
				|  |  |  }
 | 
	
	
		
			
				|  | @@ -45,6 +44,14 @@ export function initListener() {
 | 
	
		
			
				|  |  |      console.log(settingData);
 | 
	
		
			
				|  |  |    });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +  rtc.on('speak_context', function (speakData) {
 | 
	
		
			
				|  |  | +    console.log(speakData); // 人员列表事件(人员麦序变化时广播)
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  rtc.on('switch_settings', function (data) {
 | 
	
		
			
				|  |  | +    console.log(data); // 房间设置事件
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    rtc.on('allow_sub', stream => {
 | 
	
		
			
				|  |  |      alert('监听到有流');
 | 
	
		
			
				|  |  |      rtc.trySubscribeStream({
 | 
	
	
		
			
				|  | @@ -57,6 +64,11 @@ export function initListener() {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |    });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  rtc.on('publishStreamErr', function (data) {
 | 
	
		
			
				|  |  | +    console.log('推流意外终止:' + data.streamName);
 | 
	
		
			
				|  |  | +    // 直播开启状态下,尝试重推这条流
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
	
		
			
				|  | @@ -113,8 +125,24 @@ export function createLocalStream() {
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  | + * @method closeVideo
 | 
	
		
			
				|  |  | + * @description 结束本地流
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +export function closeVideo() {
 | 
	
		
			
				|  |  | +  rtc.closeVideo({
 | 
	
		
			
				|  |  | +    streamName: 'main',
 | 
	
		
			
				|  |  | +    success: function () {
 | 
	
		
			
				|  |  | +      console.log('结束本地流成功');
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    fail: function (str) {
 | 
	
		
			
				|  |  | +      console.log(str);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  |   * @method publishStream
 | 
	
		
			
				|  |  | - * @description 推流
 | 
	
		
			
				|  |  | + * @description 推送本地流
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  export function publishStream() {
 | 
	
		
			
				|  |  |    rtc.publish({
 | 
	
	
		
			
				|  | @@ -156,3 +184,67 @@ export function publishStream() {
 | 
	
		
			
				|  |  |  export function handsUp(data) {
 | 
	
		
			
				|  |  |    rtc.handsUp(data);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * @method pauseAudio
 | 
	
		
			
				|  |  | + * @description 关闭本地流声音
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +export function pauseAudio() {
 | 
	
		
			
				|  |  | +  rtc.pauseAudio({
 | 
	
		
			
				|  |  | +    streamName: 'main',
 | 
	
		
			
				|  |  | +    success: function () {
 | 
	
		
			
				|  |  | +      console.log('关闭本地流声音成功');
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    fail: function (str) {
 | 
	
		
			
				|  |  | +      console.log(str);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * @method playAudio
 | 
	
		
			
				|  |  | + * @description 开启本地流声音
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +export function playAudio() {
 | 
	
		
			
				|  |  | +  rtc.playAudio({
 | 
	
		
			
				|  |  | +    streamName: 'main',
 | 
	
		
			
				|  |  | +    success: function () {
 | 
	
		
			
				|  |  | +      console.log('开启本地流声音成功');
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    fail: function (str) {
 | 
	
		
			
				|  |  | +      console.log(str);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * @method pauseVideo
 | 
	
		
			
				|  |  | + * @description 关闭本地流视频画面
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +export function pauseVideo() {
 | 
	
		
			
				|  |  | +  rtc.pauseVideo({
 | 
	
		
			
				|  |  | +    streamName: 'main',
 | 
	
		
			
				|  |  | +    success: function () {
 | 
	
		
			
				|  |  | +      console.log('关闭本地流视频画面成功');
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    fail: function (str) {
 | 
	
		
			
				|  |  | +      console.log(str);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * @method playVideo
 | 
	
		
			
				|  |  | + * @description 开启本地流视频画面
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +export function playVideo() {
 | 
	
		
			
				|  |  | +  rtc.playVideo({
 | 
	
		
			
				|  |  | +    streamName: 'main',
 | 
	
		
			
				|  |  | +    success: function () {
 | 
	
		
			
				|  |  | +      console.log('开启本地流视频画面成功');
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    fail: function (str) {
 | 
	
		
			
				|  |  | +      console.log(str);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  | +}
 |