From 757e5a26bfd76ad1a6a69d7dd9617aaf7e241634 Mon Sep 17 00:00:00 2001 From: John McDole Date: Thu, 3 Oct 2019 09:31:58 -0700 Subject: [PATCH 1/2] BugFix: `formatHint` was meant for network streams. This hint is only valid in the network path. --- packages/video_player/CHANGELOG.md | 4 ++++ packages/video_player/lib/video_player.dart | 7 ++++--- packages/video_player/pubspec.yaml | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/video_player/CHANGELOG.md b/packages/video_player/CHANGELOG.md index ca3a82880b10..a4d1dbeff35d 100644 --- a/packages/video_player/CHANGELOG.md +++ b/packages/video_player/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.10.2+3 + +* Fix bug where formatHint was not being pass down to network sources. + ## 0.10.2+2 * Update and migrate iOS example project. diff --git a/packages/video_player/lib/video_player.dart b/packages/video_player/lib/video_player.dart index 059799b017b3..f1b0e7c9791d 100644 --- a/packages/video_player/lib/video_player.dart +++ b/packages/video_player/lib/video_player.dart @@ -207,13 +207,14 @@ class VideoPlayerController extends ValueNotifier { }; break; case DataSourceType.network: - dataSourceDescription = {'uri': dataSource}; - break; - case DataSourceType.file: dataSourceDescription = { 'uri': dataSource, 'formatHint': _videoFormatStringMap[formatHint] }; + break; + case DataSourceType.file: + dataSourceDescription = {'uri': dataSource}; + break; } final Map response = await _channel.invokeMapMethod( diff --git a/packages/video_player/pubspec.yaml b/packages/video_player/pubspec.yaml index ee47cd813add..4c32a11a851a 100644 --- a/packages/video_player/pubspec.yaml +++ b/packages/video_player/pubspec.yaml @@ -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 -version: 0.10.2+2 +version: 0.10.2+3 homepage: https://github.com/flutter/plugins/tree/master/packages/video_player flutter: From f0b64947fae96a1684a0f5a0a5b7458fb3858b51 Mon Sep 17 00:00:00 2001 From: John McDole Date: Mon, 7 Oct 2019 10:28:19 -0700 Subject: [PATCH 2/2] Add test for the moved code --- packages/video_player/test/video_player_test.dart | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/video_player/test/video_player_test.dart b/packages/video_player/test/video_player_test.dart index 41fb897b9196..a0280e2f4df8 100644 --- a/packages/video_player/test/video_player_test.dart +++ b/packages/video_player/test/video_player_test.dart @@ -112,6 +112,20 @@ void main() { expect( fakeVideoPlayerPlatform.dataSourceDescriptions[0], { 'uri': 'https://127.0.0.1', + 'formatHint': null, + }); + }); + + test('initialize network with hint', () async { + final VideoPlayerController controller = VideoPlayerController.network( + 'https://127.0.0.1', + formatHint: VideoFormat.dash); + await controller.initialize(); + + expect( + fakeVideoPlayerPlatform.dataSourceDescriptions[0], { + 'uri': 'https://127.0.0.1', + 'formatHint': 'dash', }); }); @@ -123,7 +137,6 @@ void main() { expect( fakeVideoPlayerPlatform.dataSourceDescriptions[0], { 'uri': 'file://a.avi', - 'formatHint': null, }); }); });