Fix buffering behaviour and eventSink bug on iOS

This commit is contained in:
Ryan Heise 2020-02-05 13:30:24 +11:00
parent eee50d712e
commit fb0cd4af7d
2 changed files with 26 additions and 2 deletions

View File

@ -0,0 +1,18 @@
#
# NOTE: This podspec is NOT to be published. It is only used as a local source!
#
Pod::Spec.new do |s|
s.name = 'Flutter'
s.version = '1.0.0'
s.summary = 'High-performance, high-fidelity mobile apps.'
s.description = <<-DESC
Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
DESC
s.homepage = 'https://flutter.io'
s.license = { :type => 'MIT' }
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.vendored_frameworks = 'Flutter.framework'
end

View File

@ -114,6 +114,7 @@
} }
- (void)broadcastPlaybackEvent { - (void)broadcastPlaybackEvent {
if (!_eventSink) return;
long long now = (long long)([[NSDate date] timeIntervalSince1970] * 1000.0); long long now = (long long)([[NSDate date] timeIntervalSince1970] * 1000.0);
_updatePosition = [self getCurrentPosition]; _updatePosition = [self getCurrentPosition];
_updateTime = now; _updateTime = now;
@ -150,6 +151,11 @@
[self broadcastPlaybackEvent]; [self broadcastPlaybackEvent];
} }
- (void)setPlaybackBufferingState:(enum PlaybackState)state buffering:(BOOL)buffering {
_buffering = buffering;
[self setPlaybackState:state];
}
- (void)setUrl:(NSString*)url result:(FlutterResult)result { - (void)setUrl:(NSString*)url result:(FlutterResult)result {
// TODO: error if already connecting // TODO: error if already connecting
_connectionResult = result; _connectionResult = result;
@ -271,7 +277,7 @@
[_player pause]; [_player pause];
[_player seekToTime:CMTimeMake(0, 1000) [_player seekToTime:CMTimeMake(0, 1000)
completionHandler:^(BOOL finished) { completionHandler:^(BOOL finished) {
[self setPlaybackState:stopped]; [self setPlaybackBufferingState:stopped buffering:NO];
}]; }];
} }
@ -279,7 +285,7 @@
[_player pause]; [_player pause];
[_player seekToTime:CMTimeMake(0, 1000) [_player seekToTime:CMTimeMake(0, 1000)
completionHandler:^(BOOL finished) { completionHandler:^(BOOL finished) {
[self setPlaybackState:completed]; [self setPlaybackBufferingState:completed buffering:NO];
}]; }];
} }