Commit 54dda7ae4f27a772c02ff08b7b8be78d790354f6

Authored by 王军波
1 parent f8678cc1

替换成View实现

LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLivePlayerController.m
@@ -12,7 +12,20 @@ @@ -12,7 +12,20 @@
12 #import "LVCUGCBackgroundView.h" 12 #import "LVCUGCBackgroundView.h"
13 13
14 14
15 -@interface LVCUGCLivePlayerController () 15 +@interface LVCUGCLivePlayerController () {
  16 +
  17 + float _oneY;
  18 + float _SecondY;
  19 + float _ThirdY;
  20 + UIView *_tempView;
  21 + UIPanGestureRecognizer *_pan;
  22 +}
  23 +
  24 +@property (nonatomic, strong) UIView *viewOne;
  25 +@property (nonatomic, strong) UIView *viewSecond;
  26 +@property (nonatomic, strong) UIView *viewThird;
  27 +
  28 +@property (nonatomic, strong) CNLiveMoviePlayerController *player; // 播放器
16 29
17 @property (nonatomic, strong) LVCUGCBackgroundView *bgView; // 背景视图 30 @property (nonatomic, strong) LVCUGCBackgroundView *bgView; // 背景视图
18 31
@@ -39,12 +52,298 @@ @@ -39,12 +52,298 @@
39 52
40 self.view.backgroundColor = [UIColor whiteColor]; 53 self.view.backgroundColor = [UIColor whiteColor];
41 54
  55 + [self.view addSubview:_viewOne];
  56 + [self.view addSubview:_viewSecond];
  57 + [self.view addSubview:_viewThird];
  58 +
  59 + _pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGesture:)];
  60 + [_viewSecond addGestureRecognizer:_pan];
  61 +
  62 + [self installMovieNotificationObservers];
  63 +
  64 + _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:@"60_iOStest"
  65 + authSuccess:^{
  66 +
  67 + _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO;
  68 + _player.view.frame = self.view.bounds;
  69 + _player.shouldAutoplay = YES;
  70 + [_player prepareToPlay];
  71 + [_viewSecond addSubview:_player.view];
  72 + [_viewSecond sendSubviewToBack:_player.view];
  73 +
  74 + } authFailed:^(NSDictionary *errorInfo) {
  75 + NSLog(@"初始化直播播放器失败:%@", errorInfo);
  76 +
  77 + } getAnchorStatusResult:^(BOOL result) {
  78 +
  79 + NSLog(@"-------------获取主播状态%d", result ? YES : NO);
  80 +
  81 + }];
  82 +
42 //[self.view addSubview:self.bgView]; 83 //[self.view addSubview:self.bgView];
43 } 84 }
44 85
  86 +#pragma mark - UIPanGestureRecognizer !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  87 +- (void)panGesture:(UIPanGestureRecognizer *)recognizer {
  88 +
  89 + CGPoint t = [recognizer translationInView:_viewSecond];
  90 + //NSLog(@"移动距离>>>>>>>>>>>>>>%f",t.y);
  91 +
  92 + _viewOne.frame = CGRectMake(0, _oneY + t.y, SCREEN_WIDTH, SCREEN_HEIGHT);
  93 + _viewSecond.frame = CGRectMake(0, _SecondY + t.y, SCREEN_WIDTH, SCREEN_HEIGHT);
  94 + _viewThird.frame = CGRectMake(0, _ThirdY + t.y, SCREEN_WIDTH, SCREEN_HEIGHT);
  95 +
  96 + switch (recognizer.state) {
  97 + case UIGestureRecognizerStateBegan:
  98 + case UIGestureRecognizerStateChanged:
  99 + {
  100 +
  101 + }
  102 + break;
  103 + case UIGestureRecognizerStateEnded:
  104 + case UIGestureRecognizerStateFailed:
  105 + case UIGestureRecognizerStateCancelled:
  106 + {
  107 + if (t.y > 100) {
  108 + [UIView animateWithDuration:0.2 animations:^{
  109 +
  110 + _viewOne.frame = CGRectMake(0, _oneY + SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  111 + _viewSecond.frame = CGRectMake(0, _SecondY + SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  112 + _viewThird.frame = CGRectMake(0, _ThirdY + SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  113 +
  114 + } completion:^(BOOL finished) {
  115 +
  116 +
  117 + [_viewSecond removeGestureRecognizer:_pan];
  118 + _viewThird.frame = CGRectMake(0, -SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  119 + _tempView = _viewOne;
  120 + _viewOne = _viewThird;
  121 + _viewThird = _viewSecond;
  122 + _viewSecond = _tempView;
  123 + [_viewSecond addGestureRecognizer:_pan];
  124 +
  125 + _oneY = _viewOne.frame.origin.y;
  126 + _SecondY = _viewSecond.frame.origin.y;
  127 + _ThirdY = _viewThird.frame.origin.y;
  128 + }];
  129 + } else if (t.y < -100) {
  130 +
  131 + [UIView animateWithDuration:0.2 animations:^{
  132 +
  133 + _viewOne.frame = CGRectMake(0, _oneY - SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  134 + _viewSecond.frame = CGRectMake(0, _SecondY - SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  135 + _viewThird.frame = CGRectMake(0, _ThirdY - SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  136 +
  137 + } completion:^(BOOL finished) {
  138 +
  139 + [_viewSecond removeGestureRecognizer:_pan];
  140 + _viewOne.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT);
  141 + _tempView = _viewOne;
  142 + _viewOne = _viewSecond;
  143 + _viewSecond = _viewThird;
  144 + _viewThird = _tempView;
  145 + [_viewSecond addGestureRecognizer:_pan];
  146 +
  147 + _oneY = _viewOne.frame.origin.y;
  148 + _SecondY = _viewSecond.frame.origin.y;
  149 + _ThirdY = _viewThird.frame.origin.y;
  150 + }];
  151 +
  152 + } else {
  153 +
  154 + [UIView animateWithDuration:0.2 animations:^{
  155 +
  156 + _viewOne.frame = CGRectMake(0, _oneY, SCREEN_WIDTH, SCREEN_HEIGHT);
  157 + _viewSecond.frame = CGRectMake(0, _SecondY, SCREEN_WIDTH, SCREEN_HEIGHT);
  158 + _viewThird.frame = CGRectMake(0, _ThirdY, SCREEN_WIDTH, SCREEN_HEIGHT);
  159 +
  160 + } completion:^(BOOL finished) {
  161 + _oneY = _viewOne.frame.origin.y;
  162 + _SecondY = _viewSecond.frame.origin.y;
  163 + _ThirdY = _viewThird.frame.origin.y;
  164 + }];
  165 + }
  166 + }
  167 + break;
  168 + default:
  169 + break;
  170 + }
  171 +}
  172 +
  173 +#pragma mark - 添加通知监听 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  174 +-(void)installMovieNotificationObservers //添加视频播放通知
  175 +{
  176 + //视频加载状态改变
  177 + [[NSNotificationCenter defaultCenter] addObserver:self
  178 + selector:@selector(loadStateDidChange:)
  179 + name:MPMoviePlayerLoadStateDidChangeNotification
  180 + object:nil];
  181 +
  182 + //视频播放错误及结束原因
  183 + [[NSNotificationCenter defaultCenter] addObserver:self
  184 + selector:@selector(moviePlayBackDidFinish:)
  185 + name:MPMoviePlayerPlaybackDidFinishNotification
  186 + object:nil];
  187 +
  188 + //视频缓冲至可播放状态
  189 + [[NSNotificationCenter defaultCenter] addObserver:self
  190 + selector:@selector(mediaIsPreparedToPlayDidChange:)
  191 + name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification
  192 + object:nil];
  193 +
  194 + //视频播放状态改变
  195 + [[NSNotificationCenter defaultCenter] addObserver:self
  196 + selector:@selector(moviePlayBackStateDidChange:)
  197 + name:MPMoviePlayerPlaybackStateDidChangeNotification
  198 + object:nil];
  199 +
  200 +
  201 + //获取主播状态通知(点播和普通播放不需要注册该通知)
  202 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(anchorStatusChanged:)
  203 + name:CNLiveAnchorStatusChangedNotification
  204 + object:nil];
  205 +
  206 +}
  207 +
  208 +#pragma mark - 通知 Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  209 +- (void)loadStateDidChange:(NSNotification *)notification //视频加载状态改变
  210 +{
  211 + if (_player) {
  212 + MPMovieLoadState loadState = _player.loadState;
  213 + if ((loadState & MPMovieLoadStatePlaythroughOK) != 0) {
  214 +
  215 + NSLog(@"loadStateDidChange: MPMovieLoadStatePlaythroughOK: %d\n", (int)loadState);
  216 +
  217 + } else if ((loadState & MPMovieLoadStateStalled) != 0) {
  218 + NSLog(@"loadStateDidChange: MPMovieLoadStateStalled: %d\n", (int)loadState);
  219 +
  220 + } else {
  221 + NSLog(@"loadStateDidChange: ???: %d\n", (int)loadState);
  222 + }
  223 + }
  224 +}
  225 +
  226 +
  227 +- (void)moviePlayBackDidFinish:(NSNotification *)notification //视频播放错误及结束原因
  228 +{
  229 + if (_player) {
  230 + int reason = [[[notification userInfo] valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue];
  231 + if (MPMovieFinishReasonPlaybackError == reason) {
  232 +
  233 +
  234 + } else {
  235 +
  236 + }
  237 +
  238 + switch (reason)
  239 + {
  240 + case MPMovieFinishReasonPlaybackEnded:
  241 + NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason);
  242 + break;
  243 +
  244 + case MPMovieFinishReasonUserExited:
  245 + NSLog(@"playbackStateDidChange: MPMovieFinishReasonUserExited: %d\n", reason);
  246 + break;
  247 +
  248 + case MPMovieFinishReasonPlaybackError:
  249 + NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackError: %d\n", reason);
  250 + break;
  251 +
  252 + default:
  253 + NSLog(@"playbackPlayBackDidFinish: ???: %d\n", reason);
  254 + break;
  255 + }
  256 + }
  257 +}
45 258
46 -#pragma mark - getMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
47 259
  260 +- (void)mediaIsPreparedToPlayDidChange:(NSNotification *)notification //视频缓冲至可播放状态
  261 +{
  262 + if (_player) {
  263 + NSLog(@"isPreparedToPlay");
  264 + // if (_loadingView) {
  265 + // [_loadingView removeFromSuperview];
  266 + // }
  267 + }
  268 +}
  269 +
  270 +
  271 +- (void)moviePlayBackStateDidChange:(NSNotification *)notification //视频播放状态改变
  272 +{
  273 + if (_player) {
  274 +
  275 + switch (_player.playbackState) {
  276 + case MPMoviePlaybackStateStopped: {
  277 +
  278 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateStopped");
  279 + break;
  280 + }
  281 + case MPMoviePlaybackStatePlaying: {
  282 +
  283 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStatePlaying");
  284 + break;
  285 + }
  286 + case MPMoviePlaybackStatePaused:
  287 +
  288 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStatePaused");
  289 + break;
  290 + case MPMoviePlaybackStateInterrupted:
  291 +
  292 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateInterrupted");
  293 + break;
  294 + case MPMoviePlaybackStateSeekingForward:
  295 +
  296 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateSeekingForward");
  297 + break;
  298 + case MPMoviePlaybackStateSeekingBackward:
  299 +
  300 + NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateSeekingBackward");
  301 + break;
  302 + default:
  303 +
  304 + NSLog(@"moviePlayBackStateDidChange : %ld", (long)_player.playbackState);
  305 + break;
  306 + }
  307 + }
  308 +}
  309 +
  310 +
  311 +- (void)anchorStatusChanged:(NSNotification *)notification // 获取主播状态通知
  312 +{
  313 + if (_player.anchorStatus == 2) { // 已结束
  314 +
  315 + }
  316 + // _bgView.anchorStatus = _player.anchorStatus;
  317 +}
  318 +
  319 +
  320 +- (void)anchorStatusConnectFailed //重新连接获取主播状态
  321 +{
  322 +
  323 +}
  324 +
  325 +#pragma mark - 移除通知 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  326 +- (void)removeMovieNotificationObservers
  327 +{
  328 + [[NSNotificationCenter defaultCenter]removeObserver:self
  329 + name:MPMoviePlayerLoadStateDidChangeNotification
  330 + object:nil];
  331 + [[NSNotificationCenter defaultCenter]removeObserver:self
  332 + name:MPMoviePlayerPlaybackDidFinishNotification
  333 + object:nil];
  334 + [[NSNotificationCenter defaultCenter]removeObserver:self
  335 + name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification
  336 + object:nil];
  337 + [[NSNotificationCenter defaultCenter]removeObserver:self
  338 + name:MPMoviePlayerPlaybackStateDidChangeNotification
  339 + object:nil];
  340 +
  341 + [[NSNotificationCenter defaultCenter]removeObserver:self
  342 + name:CNLiveAnchorStatusChangedNotification
  343 + object:nil];
  344 +}
  345 +
  346 +#pragma mark - getMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
48 - (LVCUGCBackgroundView *)bgView { 347 - (LVCUGCBackgroundView *)bgView {
49 348
50 if (!_bgView) { 349 if (!_bgView) {
@@ -55,6 +354,33 @@ @@ -55,6 +354,33 @@
55 return _bgView; 354 return _bgView;
56 } 355 }
57 356
  357 +- (UIView *)viewOne {
  358 + if (!_viewOne) {
  359 + _viewOne = [[UIView alloc] initWithFrame:CGRectMake(0, -SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT)];
  360 + _viewOne.backgroundColor = [UIColor orangeColor];
  361 + _oneY = -SCREEN_HEIGHT;
  362 + }
  363 + return _viewOne;
  364 +}
  365 +
  366 +- (UIView *)viewSecond {
  367 + if (!_viewSecond) {
  368 + _viewSecond = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  369 + _viewSecond.backgroundColor = [UIColor redColor];
  370 + _SecondY = 0;
  371 + }
  372 + return _viewSecond;
  373 +}
  374 +
  375 +- (UIView *)viewThird {
  376 + if (!_viewThird) {
  377 + _viewThird = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT)];
  378 + _viewThird.backgroundColor = [UIColor blueColor];
  379 + _ThirdY = SCREEN_HEIGHT;
  380 + }
  381 + return _viewThird;
  382 +}
  383 +
58 #pragma mark - 内存警告 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 384 #pragma mark - 内存警告 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
59 - (void)didReceiveMemoryWarning { 385 - (void)didReceiveMemoryWarning {
60 [super didReceiveMemoryWarning]; 386 [super didReceiveMemoryWarning];
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCLivePlayerCell.h
@@ -14,10 +14,6 @@ @@ -14,10 +14,6 @@
14 14
15 @property (nonatomic, strong) LVCUGCPlayerLoadingView *loadingView; 15 @property (nonatomic, strong) LVCUGCPlayerLoadingView *loadingView;
16 16
17 -@property (nonatomic, strong) CNLiveMoviePlayerController *player; // 播放器  
18 -  
19 -@property (nonatomic, strong) NSString *setting;  
20 -  
21 @property (nonatomic, strong) LVCUGCLivePlayerModel *model; 17 @property (nonatomic, strong) LVCUGCLivePlayerModel *model;
22 18
23 @end 19 @end
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCLivePlayerCell.m
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 if (self) { 17 if (self) {
18 self.contentView.backgroundColor = [UIColor whiteColor]; 18 self.contentView.backgroundColor = [UIColor whiteColor];
19 19
20 - [self installMovieNotificationObservers]; 20 +
21 [self addSubview:self.loadingView]; 21 [self addSubview:self.loadingView];
22 } 22 }
23 return self; 23 return self;
@@ -29,15 +29,6 @@ @@ -29,15 +29,6 @@
29 if (_model != model) { 29 if (_model != model) {
30 _model = model; 30 _model = model;
31 } 31 }
32 -  
33 -}  
34 -  
35 -- (void)setPlayer:(CNLiveMoviePlayerController *)player {  
36 -  
37 - if (_player != player) {  
38 - _player = player;  
39 - }  
40 -  
41 } 32 }
42 33
43 #pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 34 #pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -49,180 +40,4 @@ @@ -49,180 +40,4 @@
49 return _loadingView; 40 return _loadingView;
50 } 41 }
51 42
52 -#pragma mark - 添加通知监听 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
53 --(void)installMovieNotificationObservers //添加视频播放通知  
54 -{  
55 - //视频加载状态改变  
56 - [[NSNotificationCenter defaultCenter] addObserver:self  
57 - selector:@selector(loadStateDidChange:)  
58 - name:MPMoviePlayerLoadStateDidChangeNotification  
59 - object:nil];  
60 -  
61 - //视频播放错误及结束原因  
62 - [[NSNotificationCenter defaultCenter] addObserver:self  
63 - selector:@selector(moviePlayBackDidFinish:)  
64 - name:MPMoviePlayerPlaybackDidFinishNotification  
65 - object:nil];  
66 -  
67 - //视频缓冲至可播放状态  
68 - [[NSNotificationCenter defaultCenter] addObserver:self  
69 - selector:@selector(mediaIsPreparedToPlayDidChange:)  
70 - name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification  
71 - object:nil];  
72 -  
73 - //视频播放状态改变  
74 - [[NSNotificationCenter defaultCenter] addObserver:self  
75 - selector:@selector(moviePlayBackStateDidChange:)  
76 - name:MPMoviePlayerPlaybackStateDidChangeNotification  
77 - object:nil];  
78 -  
79 -  
80 - //获取主播状态通知(点播和普通播放不需要注册该通知)  
81 - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(anchorStatusChanged:)  
82 - name:CNLiveAnchorStatusChangedNotification  
83 - object:nil];  
84 -  
85 -}  
86 -  
87 -#pragma mark - 通知 Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
88 -//视频加载状态改变  
89 -- (void)loadStateDidChange:(NSNotification *)notification  
90 -{  
91 - if (_player) {  
92 - MPMovieLoadState loadState = _player.loadState;  
93 - if ((loadState & MPMovieLoadStatePlaythroughOK) != 0) {  
94 -  
95 - NSLog(@"loadStateDidChange: MPMovieLoadStatePlaythroughOK: %d\n", (int)loadState);  
96 -  
97 - } else if ((loadState & MPMovieLoadStateStalled) != 0) {  
98 - NSLog(@"loadStateDidChange: MPMovieLoadStateStalled: %d\n", (int)loadState);  
99 -  
100 - } else {  
101 - NSLog(@"loadStateDidChange: ???: %d\n", (int)loadState);  
102 - }  
103 - }  
104 -}  
105 -  
106 -//视频播放错误及结束原因  
107 -- (void)moviePlayBackDidFinish:(NSNotification *)notification  
108 -{  
109 - if (_player) {  
110 - int reason = [[[notification userInfo] valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue];  
111 - if (MPMovieFinishReasonPlaybackError == reason) {  
112 -  
113 -  
114 - } else {  
115 -  
116 - }  
117 -  
118 - switch (reason)  
119 - {  
120 - case MPMovieFinishReasonPlaybackEnded:  
121 - NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason);  
122 - break;  
123 -  
124 - case MPMovieFinishReasonUserExited:  
125 - NSLog(@"playbackStateDidChange: MPMovieFinishReasonUserExited: %d\n", reason);  
126 - break;  
127 -  
128 - case MPMovieFinishReasonPlaybackError:  
129 - NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackError: %d\n", reason);  
130 - break;  
131 -  
132 - default:  
133 - NSLog(@"playbackPlayBackDidFinish: ???: %d\n", reason);  
134 - break;  
135 - }  
136 - }  
137 -}  
138 -  
139 -//视频缓冲至可播放状态  
140 -- (void)mediaIsPreparedToPlayDidChange:(NSNotification *)notification  
141 -{  
142 - if (_player) {  
143 - NSLog(@"isPreparedToPlay");  
144 - // if (_loadingView) {  
145 - // [_loadingView removeFromSuperview];  
146 - // }  
147 - }  
148 -}  
149 -  
150 -//视频播放状态改变  
151 -- (void)moviePlayBackStateDidChange:(NSNotification *)notification  
152 -{  
153 - if (_player) {  
154 -  
155 - switch (_player.playbackState) {  
156 - case MPMoviePlaybackStateStopped: {  
157 -  
158 - NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateStopped");  
159 - break;  
160 - }  
161 - case MPMoviePlaybackStatePlaying: {  
162 -  
163 - NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStatePlaying");  
164 - break;  
165 - }  
166 - case MPMoviePlaybackStatePaused:  
167 -  
168 - NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStatePaused");  
169 - break;  
170 - case MPMoviePlaybackStateInterrupted:  
171 -  
172 - NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateInterrupted");  
173 - break;  
174 - case MPMoviePlaybackStateSeekingForward:  
175 -  
176 - NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateSeekingForward");  
177 - break;  
178 - case MPMoviePlaybackStateSeekingBackward:  
179 -  
180 - NSLog(@"moviePlayBackStateDidChange : MPMoviePlaybackStateSeekingBackward");  
181 - break;  
182 - default:  
183 -  
184 - NSLog(@"moviePlayBackStateDidChange : %ld", (long)_player.playbackState);  
185 - break;  
186 - }  
187 - }  
188 -}  
189 -  
190 -  
191 -  
192 -// 获取主播状态通知  
193 -- (void)anchorStatusChanged:(NSNotification *)notification  
194 -{  
195 - if (_player.anchorStatus == 2) { // 已结束  
196 -  
197 - }  
198 -// _bgView.anchorStatus = _player.anchorStatus;  
199 -}  
200 -  
201 -//重新连接获取主播状态  
202 -- (void)anchorStatusConnectFailed  
203 -{  
204 -  
205 -}  
206 -  
207 -#pragma mark - 移除通知 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
208 -- (void)removeMovieNotificationObservers  
209 -{  
210 - [[NSNotificationCenter defaultCenter]removeObserver:self  
211 - name:MPMoviePlayerLoadStateDidChangeNotification  
212 - object:nil];  
213 - [[NSNotificationCenter defaultCenter]removeObserver:self  
214 - name:MPMoviePlayerPlaybackDidFinishNotification  
215 - object:nil];  
216 - [[NSNotificationCenter defaultCenter]removeObserver:self  
217 - name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification  
218 - object:nil];  
219 - [[NSNotificationCenter defaultCenter]removeObserver:self  
220 - name:MPMoviePlayerPlaybackStateDidChangeNotification  
221 - object:nil];  
222 -  
223 - [[NSNotificationCenter defaultCenter]removeObserver:self  
224 - name:CNLiveAnchorStatusChangedNotification  
225 - object:nil];  
226 -}  
227 -  
228 @end 43 @end