Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[video_player] Fix pedantic lints #2321

Merged
merged 2 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/video_player/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.10.4+1

* Fix pedantic lints. This fixes some potential race conditions in cases where
futures within some video_player methods weren't being awaited correctly.

## 0.10.4

* Port plugin code to use the federated Platform Interface, instead of a MethodChannel directly.
Expand Down
10 changes: 0 additions & 10 deletions packages/video_player/video_player/analysis_options.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:test/test.dart';
Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
tearDownAll(() async {
driver.close();
await driver.close();
});

//TODO(cyanglaz): Use TabBar tabs to navigate between pages after https://github.com/flutter/flutter/issues/16991 is fixed.
Expand Down
10 changes: 5 additions & 5 deletions packages/video_player/video_player/lib/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,15 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
if (!value.initialized || _isDisposed) {
return;
}
VideoPlayerPlatform.instance.setLooping(_textureId, value.isLooping);
await VideoPlayerPlatform.instance.setLooping(_textureId, value.isLooping);
}

Future<void> _applyPlayPause() async {
if (!value.initialized || _isDisposed) {
return;
}
if (value.isPlaying) {
VideoPlayerPlatform.instance.play(_textureId);
await VideoPlayerPlatform.instance.play(_textureId);
_timer = Timer.periodic(
const Duration(milliseconds: 500),
(Timer timer) async {
Expand All @@ -347,15 +347,15 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
);
} else {
_timer?.cancel();
VideoPlayerPlatform.instance.pause(_textureId);
await VideoPlayerPlatform.instance.pause(_textureId);
}
}

Future<void> _applyVolume() async {
if (!value.initialized || _isDisposed) {
return;
}
VideoPlayerPlatform.instance.setVolume(_textureId, value.volume);
await VideoPlayerPlatform.instance.setVolume(_textureId, value.volume);
}

/// The position in the current video.
Expand All @@ -380,7 +380,7 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
} else if (position < const Duration()) {
position = const Duration();
}
VideoPlayerPlatform.instance.seekTo(_textureId, position);
await VideoPlayerPlatform.instance.seekTo(_textureId, position);
value = value.copyWith(position: position);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/video_player/video_player/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: video_player
description: Flutter plugin for displaying inline video with other Flutter
widgets on Android and iOS.
author: Flutter Team <flutter-dev@googlegroups.com>
version: 0.10.4
version: 0.10.4+1
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player

flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void main() {
);
expect(controller.textureId, isNull);
expect(await controller.position, const Duration(seconds: 0));
controller.initialize();
await controller.initialize();

await controller.dispose();

Expand Down