Skip to content

Commit

Permalink
修复IJKPlayerManager暂停播放timer未暂停问题
Browse files Browse the repository at this point in the history
  • Loading branch information
renzifeng committed Aug 27, 2020
1 parent 6f752c0 commit 5bc6492
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 27 deletions.
20 changes: 10 additions & 10 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
PODS:
- FDFullscreenPopGesture (1.1)
- MJRefresh (3.4.3)
- ZFPlayer (4.0.1):
- ZFPlayer/AVPlayer (= 4.0.1)
- ZFPlayer/ControlView (= 4.0.1)
- ZFPlayer/Core (= 4.0.1)
- ZFPlayer/ijkplayer (= 4.0.1)
- ZFPlayer/AVPlayer (4.0.1):
- ZFPlayer (4.0.2):
- ZFPlayer/AVPlayer (= 4.0.2)
- ZFPlayer/ControlView (= 4.0.2)
- ZFPlayer/Core (= 4.0.2)
- ZFPlayer/ijkplayer (= 4.0.2)
- ZFPlayer/AVPlayer (4.0.2):
- ZFPlayer/Core
- ZFPlayer/ControlView (4.0.1):
- ZFPlayer/ControlView (4.0.2):
- ZFPlayer/Core
- ZFPlayer/Core (4.0.1)
- ZFPlayer/ijkplayer (4.0.1):
- ZFPlayer/Core (4.0.2)
- ZFPlayer/ijkplayer (4.0.2):
- ZFPlayer/Core

DEPENDENCIES:
Expand All @@ -31,7 +31,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
FDFullscreenPopGesture: a8a620179e3d9c40e8e00256dcee1c1a27c6d0f0
MJRefresh: 53e3e3219f204425ee6d3e62e8733d3295944cd6
ZFPlayer: c535ad9e213dbc45638f2ef0f68d9e76ceb878a6
ZFPlayer: f2a81c41ae8dfded13d30aa42e3d40f11cdf3bb4

PODFILE CHECKSUM: a3fcbbaf309343c1c9575737d409bf95b447eef9

Expand Down
4 changes: 2 additions & 2 deletions Example/Pods/Local Podspecs/ZFPlayer.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Example/ZFPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@
INFOPLIST_FILE = "ZFPlayer/ZFPlayer-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0;
MODULEMAP_FILE = "";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.demo.ZFPlayer;
Expand Down Expand Up @@ -890,6 +891,7 @@
INFOPLIST_FILE = "ZFPlayer/ZFPlayer-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0;
MODULEMAP_FILE = "";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.demo.ZFPlayer;
Expand Down
2 changes: 1 addition & 1 deletion Example/ZFPlayer/ZFPlayer-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.2.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion ZFPlayer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'ZFPlayer'
s.version = '4.0.1'
s.version = '4.0.2'
s.summary = 'A good player made by renzifeng'
s.homepage = 'https://github.com/renzifeng/ZFPlayer'
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
3 changes: 2 additions & 1 deletion ZFPlayer/Classes/AVPlayer/ZFAVPlayerManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ - (void)replay {
- (void)seekToTime:(NSTimeInterval)time completionHandler:(void (^ __nullable)(BOOL finished))completionHandler {
if (self.totalTime > 0) {
[_player.currentItem cancelPendingSeeks];
CMTime seekTime = CMTimeMake(time, 1);
int32_t timeScale = _player.currentItem.asset.duration. timescale;
CMTime seekTime = CMTimeMakeWithSeconds(time, timeScale);
[_player seekToTime:seekTime toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero completionHandler:completionHandler];
} else {
self.seekTime = time;
Expand Down
6 changes: 5 additions & 1 deletion ZFPlayer/Classes/Core/ZFLandscapeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
}

- (BOOL)prefersHomeIndicatorAutoHidden {
return YES;
UIInterfaceOrientation currentOrientation = (UIInterfaceOrientation)[UIDevice currentDevice].orientation;
if (UIInterfaceOrientationIsLandscape(currentOrientation)) {
return YES;
}
return NO;
}

- (BOOL)prefersStatusBarHidden {
Expand Down
2 changes: 1 addition & 1 deletion ZFPlayer/Classes/Core/ZFPlayerLogManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ + (BOOL)getLogEnable {
}

+ (NSString *)version {
return @"4.0.1";
return @"4.0.2";
}

+ (void)logWithFunction:(const char *)function lineNumber:(int)lineNumber formatString:(NSString *)formatString {
Expand Down
2 changes: 2 additions & 0 deletions ZFPlayer/Classes/ijkplayer/ZFIJKPlayerManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,15 @@ - (void)play {
[self prepareToPlay];
} else {
[self.player play];
if (self.timer) [self.timer setFireDate:[NSDate date]];
self.player.playbackRate = self.rate;
_isPlaying = YES;
self.playState = ZFPlayerPlayStatePlaying;
}
}

- (void)pause {
if (self.timer) [self.timer setFireDate:[NSDate distantFuture]];
[self.player pause];
_isPlaying = NO;
self.playState = ZFPlayerPlayStatePaused;
Expand Down

0 comments on commit 5bc6492

Please sign in to comment.