setResolution method
Set different resolution (quality) for video
Implementation
void setResolution(String url) async {
if (videoPlayerController == null) {
throw StateError("The data source has not been initialized");
}
final position = await videoPlayerController!.position;
final wasPlayingBeforeChange = isPlaying()!;
pause();
await setupDataSource(pipFlutterPlayerDataSource!.copyWith(url: url));
seekTo(position!);
if (wasPlayingBeforeChange) {
play();
}
_postEvent(PipFlutterPlayerEvent(
PipFlutterPlayerEventType.changedResolution,
parameters: <String, dynamic>{"url": url},
));
}