Can't play network video from google drive. Flutter web.
ffuf-vince opened this issue · 4 comments
I've added video_player and video_player_web_hls as my dependencies. This HLS stream works https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8
. But a video file from google with a link that is constructed like this https://www.googleapis.com/drive/v3/files/$driveFileId?alt=media
doesn't work. I'm getting an error MEDIA_ERR_SRC_NOT_SUPPORTED.
some additional context: I've implemented the same video player on mobile and playing video from the same google drive link and it is supported (video plays as expected).
[✓] Flutter (Channel stable, 3.7.12, on macOS 14.1.2 23B92 darwin-arm64, locale en-GB)
• Flutter version 3.7.12 on channel stable at /Users/dbenedictos/fvm/versions/3.7.12
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4d9e56e694 (9 months ago), 2023-04-17 21:47:46 -0400
• Engine revision 1a65d409c7
• Dart version 2.19.6
• DevTools version 2.20.1
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/dbenedictos/Library/Android/sdk
• Platform android-33, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15C500b
• CocoaPods version 1.12.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.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 11.0.15+0-b2043.56-8887301)
[✓] IntelliJ IDEA Community Edition (version 2023.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 74.0.4
• Dart plugin version 231.9065
[✓] VS Code (version 1.84.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.1.2 23B92 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.234
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
We have 2 checks to decide whether we should use hls library or not
- uri.toString().contains('m3u8')
- _testIfM3u8()
Both of these must be failing for the google drive url
Thats why it is not working
We have 2 checks to decide whether we should use hls library or not
- uri.toString().contains('m3u8')
- _testIfM3u8()
Both of these must be failing for the google drive url
Thats why it is not working
is m3u8
the only format supported? a quick google search shows that google drive streams the video with a codec of mp4 x264 & mp4a aac (audio). Not sure if this is true, when I tried debugging I can't seem to find the codec form the google drive link.
@balvinderz I think I know what the issue is. When trying to access the URI with authorization headers. At the first request it is successful and sends back a 209 partial content response. when it's time to request the other bits of content, the authorization header is now missing (please see screen shots, I blocked the token for security). Do you know what might be causing this behaviour?
first request is successful because there's an authorization header attached
on the second request the header is not passed to the request. and any other succeeding requests are not performed.
can you check if any of the checks are passing first
- uri.toString().contains('m3u8')
- _testIfM3u8()