I want to display a live stream from YouTube in Flutter using a permanent URL.
It's very simple if I have the video Id by simply using youtube_player_flutter as follows:
YoutubePlayerController _controller = YoutubePlayerController(
initialVideoId: 'NpEaa2P7qZI',
params: YoutubePlayerParams(
showControls: true,
showFullscreenButton: true,
),
);
However, I want to display videos from permanent URLs like on of these:
- https://www.youtube.com/user/NASAtelevision/live
- https://www.youtube.com/embed/live_stream?channel=UCLA_DiR1FfKNvjuUpBHmylQ
The reason being that https://www.youtube.com/watch?v=nA9UZF-SZoQ where the id is nA9UZF-SZoQ (the current live stream url) is not always valid and the app will break if it changes.
Is there as solution to play permanent URLs from youtube in flutter? Do I have to use the youtube api for this or maybe look for an iframe solution instead?
Thank you.