| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- //
- // BGKSYAgoraLinkMicPlayerController.m
- // FanweApp
- //
- // Created by xfg on 2017/2/13.
- // Copyright © 2017年 xfg. All rights reserved.
- //
- #import "BGKSYAgoraLinkMicPlayerController.h"
- @interface BGKSYAgoraLinkMicPlayerController ()
- @end
- @implementation BGKSYAgoraLinkMicPlayerController
- - (void)viewDidLoad
- {
- [super viewDidLoad];
-
- _linkMicBaseController = [[BGKSYAgoraStreamerBaseController alloc] init];
- _linkMicBaseController.isApplicant = YES;
- [self addChild:_linkMicBaseController inRect:self.view.bounds];
- [self.view sendSubviewToBack:_linkMicBaseController.view];
- _linkMicBaseController.view.hidden = YES;
- }
- #pragma mark 开始连麦
- /*
- * 开始连麦
- * applicantId:申请连麦者ID
- * responderId:接收连麦者ID
- * roomId:房间ID
- */
- - (void)startLinkMic:(NSString *)applicantId andResponderId:(NSString *)responderId roomId:(NSString *)roomId
- {
- [_linkMicBaseController startLinkMic:applicantId andResponderId:responderId roomId:roomId];
- self.videoContrainerView.hidden = YES;
- _linkMicBaseController.view.hidden = NO;
- [self.txLivePlayer pause];
-
- __weak typeof(self) ws = self;
-
- _linkMicBaseController.onMyCallStart = ^(int status){
-
- if(status == 200) // 建立连接
- {
-
- }
- else if(status == 408 || status == 404) // 408:对方无应答 404:呼叫未注册号码,主动停止
- {
-
- }
-
- };
-
- _linkMicBaseController.onMyCallStop = ^(int status){
-
- ws.linkMicBaseController.view.hidden = YES;
-
- };
-
- _linkMicBaseController.onMyChannelJoin = ^(int status){
-
- };
- }
- - (void)reloadPlay
- {
- [self.txLivePlayer startLivePlay:self.playUrlStr type:PLAY_TYPE_LIVE_RTMP];
- }
- #pragma mark 停止连麦
- /*
- * 停止连麦
- * applicantId:申请连麦者ID
- */
- - (void)stopLinkMic:(NSString *)applicantId
- {
- if (_linkMicBaseController.gPUStreamerKit)
- {
- [_linkMicBaseController stopLinkMic:applicantId];
-
- self.videoContrainerView.hidden = NO;
- [self.txLivePlayer resume];
- // [self performSelector:@selector(reloadPlay) withObject:nil afterDelay:1];
- }
- }
- -(void)stopRtmp
- {
- [super stopRtmp];
- [self.txLivePlayer stopPlay];
- [self stopLinkMic:_linkMicBaseController.applicantId];
- [_linkMicBaseController stopLinkMic:_linkMicBaseController.applicantId];
- }
- #pragma mark 结束播放
- - (void)stopPlay
- {
- [self.txLivePlayer stopPlay];
- [self stopLinkMic:_linkMicBaseController.applicantId];
- [_linkMicBaseController stopLinkMic:_linkMicBaseController.applicantId];
- }
- @end
|