Thanks to visit codestin.com
Credit goes to github.com

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

[video_player] Reduce server dependencies in tests #5103

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
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ const String _videoAssetKey =
kIsWeb ? 'assets/Butterfly-209.webm' : 'assets/Butterfly-209.mp4';

// Returns the URL to load an asset from this example app as a network source.
//
// TODO(stuartmorgan): Convert this to a local `HttpServer` that vends the
// assets directly, https://github.com/flutter/flutter/issues/95420
String getUrlForAssetAsNetworkSource(String assetKey) {
return 'https://github.com/flutter/plugins/blob/'
// This hash can be rolled forward to pick up newly-added assets.
'cba393233e559c925a4daf71b06b4bb01c606762'
'cb381ced070d356799dddf24aca38ce0579d3d7b'
'/packages/video_player/video_player/example/'
'$assetKey'
'?raw=true';
Expand Down Expand Up @@ -56,7 +59,7 @@ void main() {
(WidgetTester tester) async {
final VideoPlayerController networkController =
VideoPlayerController.network(
'https://cph-p2p-msl.akamaized.net/hls/live/2000341/test/master.m3u8',
'https://flutter.github.io/assets-for-api-docs/assets/videos/hls/bee.m3u8',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you upload stuff to assets-for-api-docs? Is it the website repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a separate repo; this was: flutter/assets-for-api-docs#178

);
await networkController.initialize();

Expand Down Expand Up @@ -229,13 +232,8 @@ void main() {

group('network videos', () {
setUp(() {
// TODO(stuartmorgan): Remove this conditional and update the hash in
// getUrlForAssetAsNetworkSource as a follow-up, once the webm asset is
// checked in.
final String videoUrl = kIsWeb
? 'https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm'
: getUrlForAssetAsNetworkSource(_videoAssetKey);
_controller = VideoPlayerController.network(videoUrl);
_controller = VideoPlayerController.network(
getUrlForAssetAsNetworkSource(_videoAssetKey));
});

testWidgets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ const Duration _playDuration = Duration(seconds: 1);
const String _videoAssetKey = 'assets/Butterfly-209.mp4';

// Returns the URL to load an asset from this example app as a network source.
//
// TODO(stuartmorgan): Convert this to a local `HttpServer` that vends the
// assets directly, https://github.com/flutter/flutter/issues/95420
String getUrlForAssetAsNetworkSource(String assetKey) {
return 'https://github.com/flutter/plugins/blob/'
// This hash can be rolled forward to pick up newly-added assets.
'cba393233e559c925a4daf71b06b4bb01c606762'
'cb381ced070d356799dddf24aca38ce0579d3d7b'
'/packages/video_player/video_player/example/'
'$assetKey'
'?raw=true';
Expand Down Expand Up @@ -155,7 +158,7 @@ void main() {

testWidgets('live stream duration != 0', (WidgetTester tester) async {
final MiniController livestreamController = MiniController.network(
'https://cph-p2p-msl.akamaized.net/hls/live/2000341/test/master.m3u8',
'https://flutter.github.io/assets-for-api-docs/assets/videos/hls/bee.m3u8',
);
await livestreamController.initialize();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ const Duration _playDuration = Duration(seconds: 1);
const String _videoAssetKey = 'assets/Butterfly-209.mp4';

// Returns the URL to load an asset from this example app as a network source.
//
// TODO(stuartmorgan): Convert this to a local `HttpServer` that vends the
// assets directly, https://github.com/flutter/flutter/issues/95420
String getUrlForAssetAsNetworkSource(String assetKey) {
return 'https://github.com/flutter/plugins/blob/'
// This hash can be rolled forward to pick up newly-added assets.
'cba393233e559c925a4daf71b06b4bb01c606762'
'cb381ced070d356799dddf24aca38ce0579d3d7b'
'/packages/video_player/video_player/example/'
'$assetKey'
'?raw=true';
Expand Down Expand Up @@ -167,7 +170,7 @@ void main() {

testWidgets('live stream duration != 0', (WidgetTester tester) async {
final MiniController livestreamController = MiniController.network(
'https://cph-p2p-msl.akamaized.net/hls/live/2000341/test/master.m3u8',
'https://flutter.github.io/assets-for-api-docs/assets/videos/hls/bee.m3u8',
);
await livestreamController.initialize();

Expand Down