Fix setSpeed bug on iOS.
This commit is contained in:
parent
3c37235e03
commit
f1aaa0b132
|
@ -39,6 +39,7 @@
|
|||
BOOL _automaticallyWaitsToMinimizeStalling;
|
||||
BOOL _configuredSession;
|
||||
BOOL _playing;
|
||||
float _speed;
|
||||
}
|
||||
|
||||
- (instancetype)initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar playerId:(NSString*)idParam configuredSession:(BOOL)configuredSession {
|
||||
|
@ -74,6 +75,7 @@
|
|||
_loadResult = nil;
|
||||
_playResult = nil;
|
||||
_automaticallyWaitsToMinimizeStalling = YES;
|
||||
_speed = 1.0f;
|
||||
__weak __typeof__(self) weakSelf = self;
|
||||
[_methodChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
|
||||
[weakSelf handleMethodCall:call result:result];
|
||||
|
@ -919,7 +921,7 @@
|
|||
[[AVAudioSession sharedInstance] setActive:YES error:nil];
|
||||
}
|
||||
#endif
|
||||
[_player play];
|
||||
_player.rate = _speed;
|
||||
[self updatePosition];
|
||||
if (@available(macOS 10.12, iOS 10.0, *)) {}
|
||||
else {
|
||||
|
@ -961,8 +963,11 @@
|
|||
if (speed == 1.0
|
||||
|| (speed < 1.0 && _player.currentItem.canPlaySlowForward)
|
||||
|| (speed > 1.0 && _player.currentItem.canPlayFastForward)) {
|
||||
_speed = speed;
|
||||
if (_playing) {
|
||||
_player.rate = speed;
|
||||
}
|
||||
}
|
||||
[self updatePosition];
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ packages:
|
|||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.3.4"
|
||||
version: "0.4.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
Loading…
Reference in New Issue