-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
This issue is a request to change the video url in the video player plugin's example code in the readme tab.
The example uses this url: https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4 to play the video from the network. but the video seems to be taking much longer than expected and hence the plugin throws a Playback error.
And the screen remains stuck on a blank screen.
Steps to reproduce:
- Create a new flutter project
- Add
video_player: ^2.1.6plugin to pubspec.yaml - Run the below sample code taken from the docs in readme tab
Sample code
import 'package:video_player/video_player.dart';
import 'package:flutter/material.dart';
void main() => runApp(VideoApp());
class VideoApp extends StatefulWidget {
@override
_VideoAppState createState() => _VideoAppState();
}
class _VideoAppState extends State<VideoApp> {
VideoPlayerController _controller;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(
'https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4')
..initialize().then((_) {
// Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Video Demo',
home: Scaffold(
body: Center(
child: _controller.value.isInitialized
? AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
)
: Container(),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
_controller.value.isPlaying
? _controller.pause()
: _controller.play();
});
},
child: Icon(
_controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
),
),
),
);
}
@override
void dispose() {
super.dispose();
_controller.dispose();
}
}
Luckily I found the same video with another source and it seems to work fine
with this url: https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4
So I propose to change the URL from the example to this: https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
This video is stored in the flutter repository and being used across other video_player plugin examples. So I feel its safe to use that URL in the example.
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-arm, locale en-IN)
• Flutter version 2.2.2 at /Users/mahesh/Documents/flutter
• Framework revision d79295af24 (10 days ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/mahesh/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = /Users/mahesh/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] IntelliJ IDEA Community Edition (version 2021.1.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 57.0.5
• Dart plugin version 211.7233
[✓] VS Code (version 1.57.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.23.0
[✓] Connected device (4 available)
• Redmi K20 Pro (mobile) • d9dac45d • android-arm64 • Android 10 (API 29)
• sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11 (API 30) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 11.4 20F71 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114
• No issues found!
Console Logs
E/ExoPlayerImplInternal( 3470): Caused by: javax.net.ssl.SSLPeerUnverifiedException: Hostname www.sample-videos.com not verified:
E/ExoPlayerImplInternal( 3470): certificate: sha1/0e+id3K4XRkp77ga5DFRDMzrT54=
E/ExoPlayerImplInternal( 3470): DN: CN=sample-videos.com
E/ExoPlayerImplInternal( 3470): subjectAltNames: [sample-videos.com]
E/ExoPlayerImplInternal( 3470): at com.android.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:205)
E/ExoPlayerImplInternal( 3470): at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:153)
E/ExoPlayerImplInternal( 3470): at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:116)
E/ExoPlayerImplInternal( 3470): at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:186)
E/ExoPlayerImplInternal( 3470): at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
E/ExoPlayerImplInternal( 3470): at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
E/ExoPlayerImplInternal( 3470): at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
E/ExoPlayerImplInternal( 3470): at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
E/ExoPlayerImplInternal( 3470): at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
E/ExoPlayerImplInternal( 3470): at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
E/ExoPlayerImplInternal( 3470): at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.connect(DelegatingHttpsURLConnection.java:90)
E/ExoPlayerImplInternal( 3470): at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:30)
E/ExoPlayerImplInternal( 3470): at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.makeConnection(DefaultHttpDataSource.java:589)
E/ExoPlayerImplInternal( 3470): at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.makeConnection(DefaultHttpDataSource.java:493)
E/ExoPlayerImplInternal( 3470): at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:307)
E/ExoPlayerImplInternal( 3470): ... 6 more
E/flutter ( 3470): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error, null, null)
E/flutter ( 3470):