abdelaziz-mahdy / flutter_meedu_videoplayer

Cross-Platform Video Player for flutter
https://abdelaziz-mahdy.github.io/flutter_meedu_videoplayer/
MIT License
142 stars 71 forks source link

Playing Youtube Live Streams #47

Closed abhilashsajeev closed 1 year ago

abhilashsajeev commented 1 year ago

I successfully played a YouTube video by extracting the source URL, but I encountered an issue when attempting to play a live stream using the same method. Can you provide more information on how to utilize the plugin to play YouTube live streams?

abdelaziz-mahdy commented 1 year ago

What are YouTube streams type,

if bytes don't know if its possible

M3u8 should work.

Do you have any example using another package?

abhilashsajeev commented 1 year ago

@zezo357 There is https://pub.dev/packages/youtube_player_iframe. But it supports only Android , ios and web only. Can u update the code such that giving direct youtube link will also play the video.

abdelaziz-mahdy commented 1 year ago

@abhilashsajeev will check on it, and let you know what can be done.

i may take a while, so if there is a workaround for now, i recommend you to use it

abdelaziz-mahdy commented 1 year ago

@zezo357 There is https://pub.dev/packages/youtube_player_iframe. But it supports only Android , ios and web only. Can u update the code such that giving direct youtube link will also play the video.

from my understanding this package makes a webview and plays the video in it, which is very different from my package here we run the player directly in flutter this is much faster.

they are able to access stream because they play it like a browser.

I successfully played a YouTube video by extracting the source URL,

what is the problem in doing that?

abhilashsajeev commented 1 year ago

@zezo357 It would be great if your package could also support playing live streams from youtube or any such platforms

abdelaziz-mahdy commented 1 year ago

@zezo357 It would be great if your package could also support playing live streams from youtube or any such platforms

I don't understand how they work and that will make the package very complex.

But I will keep in mind if I find a way to implement it I will let you know

abhilashsajeev commented 1 year ago

@zezo357 I think youtube live is hls live streams

abdelaziz-mahdy commented 1 year ago

@zezo357 I think youtube live is hls live streams

Yes I found that too, and this package can use it,

If you are able to get the url for the other videos too they can play correctly.

abdelaziz-mahdy commented 1 year ago

in 4.0.10,I added example for playing from youtube.

abhilashsajeev commented 1 year ago

@zezo357 The youtube example working for normal videos only.vBut live streams still not supported

I have tried with this url

abdelaziz-mahdy commented 1 year ago

@zezo357 The youtube example working for normal videos only.vBut live streams still not supported

I have tried with this url

Ok will try to add live streams support

abdelaziz-mahdy commented 1 year ago

@zezo357 The youtube example working for normal videos only.vBut live streams still not supported I have tried with this url

Ok will try to add live streams support

image this url works ?

abdelaziz-mahdy commented 1 year ago

live streams now work, but since i am using video_player and it doesnt update duration i had to use initialized

so [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Bad state: Future already completed will be spammed in the console

the fix for this will be to switch fully to media_kit and drop video_player, this will happed when web support works in media_kit

abhilashsajeev commented 1 year ago

@zezo357 has this been udpated to the example page?

abdelaziz-mahdy commented 1 year ago

@zezo357 has this been udpated to the example page?

Yes. On GitHub, the same page updated to read live streams

Test and let me know, the video should be working, but the replay button is showing, that happens since duration is not updated and will fix it in the next release, but that doesn't fix the future already completed part.