Commit e42d094791d3f85c628a1503210e56779ceb3624
1 parent
5b38e734
no message
Showing
3 changed files
with
123 additions
and
57 deletions
CNLiveScioLive/Pages/Tools/ZXVideoPlayer/Classes/ZXVideoPlayerController.h
| ... | ... | @@ -8,13 +8,16 @@ |
| 8 | 8 | |
| 9 | 9 | #import <UIKit/UIKit.h> |
| 10 | 10 | #import "ZXVideo.h" |
| 11 | -@import MediaPlayer; | |
| 11 | +#import <AVKit/AVKit.h> | |
| 12 | +#import <AVFoundation/AVFoundation.h> | |
| 13 | +#import "ZXVideoPlayerControlView.h" | |
| 12 | 14 | |
| 15 | +@import MediaPlayer; | |
| 13 | 16 | #define kZXVideoPlayerOriginalWidth MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) |
| 14 | 17 | #define kZXVideoPlayerOriginalHeight (kZXVideoPlayerOriginalWidth * (9.0 / 16.0)) |
| 15 | 18 | |
| 16 | 19 | |
| 17 | -@interface ZXVideoPlayerController : MPMoviePlayerController | |
| 20 | +@interface ZXVideoPlayerController : AVPlayerViewController | |
| 18 | 21 | |
| 19 | 22 | @property (nonatomic, assign) CGRect frame; |
| 20 | 23 | /// video model |
| ... | ... | @@ -30,4 +33,6 @@ |
| 30 | 33 | /// 展示播放器 |
| 31 | 34 | - (void)showInView:(UIView *)view; |
| 32 | 35 | - (void)videoPlay; |
| 36 | +- (void)stop; | |
| 37 | + | |
| 33 | 38 | @end | ... | ... |
CNLiveScioLive/Pages/Tools/ZXVideoPlayer/Classes/ZXVideoPlayerController.m
No preview for this file type
CNLiveScioLive/Pages/Tools/ZXVideoPlayer/Classes/ZXVideoPlayerVolumeView.m
| ... | ... | @@ -81,7 +81,10 @@ static const CGFloat kVolumeIndicatorAutoFadeOutTimeInterval = 1.0; |
| 81 | 81 | - (void)volumeChanged:(NSNotification *)notification |
| 82 | 82 | { |
| 83 | 83 | float outputVolume = [[[notification userInfo] objectForKey:@"AVSystemController_AudioVolumeNotificationParameter"] floatValue]; |
| 84 | - [self updateVolumeIndicator:outputVolume]; | |
| 84 | + NSString *outputReason = [[notification userInfo] objectForKey:@"AVSystemController_AudioVolumeChangeReasonNotificationParameter"]; | |
| 85 | + if ([outputReason isEqualToString:@"ExplicitVolumeChange"]) { | |
| 86 | + [self updateVolumeIndicator:outputVolume]; | |
| 87 | + } | |
| 85 | 88 | } |
| 86 | 89 | |
| 87 | 90 | - (void)updateVolumeIndicator:(CGFloat)value | ... | ... |