feat: expose playback speed control to Flutter on iOS#7
Conversation
NicholasNagy
left a comment
There was a problem hiding this comment.
Do we also need to do something on the android side?
| playerRate = 1.0 | ||
| result(nil) | ||
| } else if speed < 0 || speed > 2.0 { | ||
| if speed < 0 || speed > 2.0 { |
There was a problem hiding this comment.
Is it necessary to check this here? Can't we check this in the dart code so that we don't need to duplicate this code in the android side as well?
There was a problem hiding this comment.
This is good suggestion. I'll remove the check from here and add it dart layer to avoid duplication
| await videoPlayerController!.setSpeed(speed); | ||
| return true; | ||
| } catch (_) { | ||
| return false; |
There was a problem hiding this comment.
I feel like if we just return a boolean, users will have a tendency just to ignore it, as I wouldn't expect anyone to react any specific way if the setSpeed functionality doesn't work. I feel like an exception is more appropriate to throw (or rethrow in this case), so that users are aware there is an issue
There was a problem hiding this comment.
Right, I agree, I'll update it
No, we do not need to make changes on android side. It is already implemented.
I'm not sure why these new files were generated but looks like these two files are automatically generated by flutter when you build the example iOS app (maybe because a change in flutter version) |
Wire up the existing native iOS setSpeed implementation to Flutter through the full method channel pipeline:
The Android side already had this wired up via BetterPlayerPlugin.java.
Speed range is 0.0 to 2.0, where 1.0 is normal playback.