Open NorteX-dev opened 3 months ago
+1
I have to downgrade the plugin to v5.1.3
to fix this issue
Same issue here.
same issue
I used cueVideoByUrl() function to play video which has dash inside video id.
before
_controller = YoutubePlayerController.fromVideoId( videoId: widget.data.videoUrl!, startSeconds: widget.data.startSeconds, endSeconds: widget.data.endSeconds, params: const YoutubePlayerParams( mute: false, loop: false, enableCaption: true, ), );
after
_controller = YoutubePlayerController( params: const YoutubePlayerParams( mute: false, loop: false, enableCaption: true, ));
_controller.cueVideoByUrl( mediaContentUrl: "http://www.youtube.com/v/${widget.data.videoUrl!}?version=5", startSeconds: widget.data.startSeconds, endSeconds: widget.data.endSeconds);
I used cueVideoByUrl() function to play video which has dash inside video id.
before
_controller = YoutubePlayerController.fromVideoId( videoId: widget.data.videoUrl!, startSeconds: widget.data.startSeconds, endSeconds: widget.data.endSeconds, params: const YoutubePlayerParams( mute: false, loop: false, enableCaption: true, ), );
after
_controller = YoutubePlayerController( params: const YoutubePlayerParams( mute: false, loop: false, enableCaption: true, ));
_controller.cueVideoByUrl( mediaContentUrl: "http://www.youtube.com/v/${widget.data.videoUrl!}?version=5", startSeconds: widget.data.startSeconds, endSeconds: widget.data.endSeconds);
This helped resolve the issue. Thanks for sharing.
Any update on this?
Is there an existing issue for this?
Package
youtube_player_iframe (Default)
What happened?
Let's assume the youtube video ID contains dash symbols, the video fails to load, since the ID is trimmed to the strnig preceding the dash.
Take this ID for example:
Jl1-bmN1b8o
(this is a correct youtube id). This contains a dash as the fourth char. A video player is constructed (minimal repro below) with said ID. The video fails to load, the app shows "An error occured" and you can see, how the wrong ID is fetched and printed:I/chromium(31976): [INFO:CONSOLE(123)] "Uncaught ReferenceError: YoutubeJl1 is not defined", source: https://www.youtube.com/ (123)
As you can see, it's trying to load YoutubeJl1, which is where the dash was met.
What is the expected behaviour?
The ID is not trimmed. Video is played as should.
How to reproduce?
Use this minimal reproduction:
main.dart:
widgets/video_player.dart:
The above code contains a VideoPlayer widget and a home page.
pubspec.yaml