Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am just wondering if audio_service can work with url_audio_stream? #298

Closed
sandrhymend opened this issue May 3, 2020 · 18 comments
Closed
Assignees
Labels
1 backlog question Further information is requested

Comments

@sandrhymend
Copy link

sandrhymend commented May 3, 2020

I am just wondering if audio_service can work with url_audio_stream?
I tried to implement a streaming radio url with just_audio but the url does not work and if I tried to implement the audio service with this other package "url_audio_stream" neither work.

More specific ... the problem is how can I implement the MediaItem for ios control center ... :(
I am newbie with Flutter and it is a little hard to follow the api info and the samples does not work for my case. Anyone can help me or give an idea how to implement this?

@sandrhymend sandrhymend added 1 backlog question Further information is requested labels May 3, 2020
@sandrhymend
Copy link
Author

I figure out how to implement it and it works with url_audio_stream :)

@diego-lipinski-de-castro

Can you provide an example? I would like to do the same

@sandrhymend
Copy link
Author

sandrhymend commented May 22, 2020

Can you provide an example? I would like to do the same
Thanks but I found that url_audio_stream is deprecated. I decided to go with different package. It works pretty well with ios but not with android. I got a lot of errors :(

@diego-lipinski-de-castro

which one? I need to stream im background so if you did it i would like to know

@sandrhymend
Copy link
Author

which one? I need to stream im background so if you did it i would like to know

I am still doing my research what package should I use. I am facing a lot of problems with HTTPS live streaming with m3u8 format. :(

@diego-lipinski-de-castro
Copy link

diego-lipinski-de-castro commented May 24, 2020

I got it to work, i used just_audio (because thats what is used in the example as the AudioPlayer), and added the stream url with the setUrl audio as normal, the url im using is https://live.paineldj.com.br/proxy/ocpfm?mp=/stream, I run the AudioService.start on the initState and I start the stream on the onStart method of my BackgroundTask with the play method (I also set the url on this method)

@sandrhymend
Copy link
Author

I got it to work, i used just_audio (because thats what is used in the example as the AudioPlayer), and added the stream url with the setUrl audio as normal, the url im using is https://live.paineldj.com.br/proxy/ocpfm?mp=/stream, I run the AudioService.start on the initState and I start the stream on the onStart method of my BackgroundTask with the play method (I also set the url on this method)

That's great :)
I will try the same packages as well, I figured out that my problem was the url.
Good luck

@ryanheise
Copy link
Owner

I am still doing my research what package should I use. I am facing a lot of problems with HTTPS live streaming with m3u8 format. :(

I don't have any experience with url_audio_stream but one thing to be aware of on Android, is that the Android implementation guesses the stream type by looking at the URL extension. So if the URL you want to stream from doesn't end with ".m3u8" but you know it is an m3u8 stream, you can add "#.m3u8" at the end of the URL which won't get sent to the server (since it's a fragment), but it acts as a hint to the Android implementation to help it recognise the URL as an m3u8 stream.

@sandrhymend
Copy link
Author

I am still doing my research what package should I use. I am facing a lot of problems with HTTPS live streaming with m3u8 format. :(

I don't have any experience with url_audio_stream but one thing to be aware of on Android, is that the Android implementation guesses the stream type by looking at the URL extension. So if the URL you want to stream from doesn't end with ".m3u8" but you know it is an m3u8 stream, you can add "#.m3u8" at the end of the URL which won't get sent to the server (since it's a fragment), but it acts as a hint to the Android implementation to help it recognise the URL as an m3u8 stream.

Thank you, I am using a url without that format and It works pretty well with just_audio and audio_service.

@ryanheise
Copy link
Owner

Do you mean that m3u8 streams work on Android without adding the "#.m3u8" hint? If so, I would be curious to know which version of Android are you using?

@sandrhymend
Copy link
Author

Do you mean that m3u8 streams work on Android without adding the "#.m3u8" hint? If so, I would be curious to know which version of Android are you using?

No, I am using another package to parse m3u url and get the http url. My link ended with m3u, and it does not work on android 28.
Sorry if I was not clear.
Thank you :)

@ryanheise
Copy link
Owner

That's OK, I was probably not clear with my comment either. My comment above about adding the "#.m3u8" hint was specific to the Android implementation of this plugin (just_audio) since it will not automatically detect the stream type unless the URL ends with .m3u8 . So adding "#.m3u8" to the end of the URL will make it work.

@sandrhymend
Copy link
Author

That's OK, I was probably not clear with my comment either. My comment above about adding the "#.m3u8" hint was specific to the Android implementation of this plugin (just_audio) since it will not automatically detect the stream type unless the URL ends with .m3u8 . So adding "#.m3u8" to the end of the URL will make it work.

I tried it but it did not work on my case. My link ended something like this "any&m=m3u" I found this package M3U format parser and it works.

I couldn't find another way to handle
Thanks :)

@ryanheise
Copy link
Owner

Would you mind sharing the full link? If ending the link like "any&m=m3u#.m3u8" doesn't work, then it's a bug I'd like to know about so I can fix it.

@sandrhymend
Copy link
Author

Would you mind sharing the full link? If ending the link like "any&m=m3u#.m3u8" doesn't work, then it's a bug I'd like to know about so I can fix it.

Here it is
https://samcloud.spacial.com/api/listen?sid=68536&rid=155608&f=mp3,any&br=96000,any&m=m3u

@ryanheise
Copy link
Owner

I've just checked upstream and ExoPlayer currently supports m3u8 but not m3u. There's an open issue here:

google/ExoPlayer#4066

But yes, the only way for now is to use your own parser for m3u.

@sandrhymend
Copy link
Author

I've just checked upstream and ExoPlayer currently supports m3u8 but not m3u. There's an open issue here:

google/ExoPlayer#4066

But yes, the only way for now is to use your own parser for m3u.

Thank you for your help :)

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with audio_service.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 backlog question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants