Commit 54050b5f1db411bc4733298e7f922d80c52674d3
1 parent
1b41c8fe
no message
Showing
2 changed files
with
10 additions
and
7 deletions
CNLivePlayer/Classes/Player/CNLivePlayer.m
| ... | ... | @@ -66,15 +66,18 @@ NSString * const CNLiveHostStatusChangedNotification = @"CNLiveAnchorStatusChang |
| 66 | 66 | _contentType = @""; |
| 67 | 67 | _contentId = @""; |
| 68 | 68 | _idName = @""; |
| 69 | - | |
| 69 | + | |
| 70 | 70 | [self addMovieNotificationObservers]; |
| 71 | + | |
| 71 | 72 | self.player = [[KSYMoviePlayerController alloc] initWithContentURL:url]; |
| 72 | - [self.view addSubview:self.player.view]; | |
| 73 | + | |
| 74 | + [self.view addSubview:_player.view]; | |
| 73 | 75 | _player.view.frame = self.view.bounds; |
| 74 | 76 | _player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; |
| 75 | 77 | _player.shouldEnableKSYStatModule = NO; |
| 76 | 78 | |
| 77 | 79 | } |
| 80 | + | |
| 78 | 81 | return self; |
| 79 | 82 | } |
| 80 | 83 | ... | ... |
Example/CNLivePlayer/CNLivePlayerController.m
| ... | ... | @@ -63,11 +63,11 @@ |
| 63 | 63 | [self.view addSubview:back]; |
| 64 | 64 | |
| 65 | 65 | |
| 66 | - CNLivePlayer *player = [[CNLivePlayer alloc] initWithContentURL:[NSURL URLWithString:@"http://wideo02.cnlive.com/video/data1/2017/0423/206473/800/c8ff347048414b7295cef882f8361073_206473_800.m3u8"]]; | |
| 67 | - player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*9/16.0); | |
| 68 | - player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; | |
| 69 | - [player prepareToPlay]; | |
| 70 | - [self.view addSubview:player.view]; | |
| 66 | + self.player = [[CNLivePlayer alloc] initWithContentURL:[NSURL URLWithString:@"http://wideo02.cnlive.com/video/data1/2017/0423/206473/800/c8ff347048414b7295cef882f8361073_206473_800.m3u8"]]; | |
| 67 | + self.player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*9/16.0); | |
| 68 | + self.player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; | |
| 69 | + [self.player prepareToPlay]; | |
| 70 | + [self.view addSubview:self.player.view]; | |
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | // KSYMoviePlayerController *player = [[KSYMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://wideo02.cnlive.com/video/data1/2017/0423/206473/800/c8ff347048414b7295cef882f8361073_206473_800.m3u8"]]; | ... | ... |