y20k / transistor

Transistor - Simple Radio App for Android
http://y20k.org/transistor/
MIT License
433 stars 121 forks source link

mms or rtsp support? #7

Closed sunng87 closed 8 years ago

sunng87 commented 8 years ago

Most of my stations are mms:// based. Currently we cannot input mms url to transistor. I hope you can add support to mms. Thanks!

y20k commented 8 years ago

In Transistor I use the official MediaPlayer library. Judging from the Android developer documentation[1] it sounds like RSTP is supported. To check if MediaPlayer can handle your stations, please post example links for mms:// and rstp:// each, if possible. Maybe your problem is related to #6. Transistor currently only supports streams that are encapsulated in m3u or pls. Check out my answer to #6 for more details.

[1] http://developer.android.com/guide/appendix/media-formats.html

sunng87 commented 8 years ago

My station url is: mms://alive.rbc.cn/fm1006

I will try your fix in #6 later to see if it works for me. Thank you very much for your response and this app!

sunng87 commented 8 years ago

Hi @y20k , the workaround doesn't work for me. After looking into the code, I found the m3u parser may only support stream url starts with http.

https://github.com/y20k/transistor/blob/master/app%2Fsrc%2Fmain%2Fjava%2Forg%2Fy20k%2Ftransistor%2Fcore%2FStation.java#L221

y20k commented 8 years ago

Hi there,

oh. Thanks for the hint ;-). I forgot how that part of the parser was supposed to work. I did broaden the condition to allow http- as well mms-URLs. The next problem here is when I convert the mms://-String into a into a JAVA URL. I get an error - because URLs must be http.

So if I want to test, if mms-links work, I need to rewrite quite a lot of code. Station URLs must be stored internally as JAVA URI instead of JAVA URL. That is in general not a bad idea. I will try that in the next couple of month. Be patient. I am working on this project in my free time. I leave this issue open so that you get informed about my progress.

Best wishes.

y20k commented 8 years ago

Hi @sunng87,

short answer: It seems that mms:// Streams are not supported by the MediaPlayer library. But RSTP is likely to work.

Here is what I tried: I changed the way stream URLs are stored within Transistor to be URI as planned. I also allowed "mms" strings to be parsed as stream URLs. Then I made an M3U ( Alive RBC.m3u ) from your station and placed it into Transistor's Collection folder. When I started Playback I got MEDIA_ERROR_UNKNOWN from MediaPlayer. Dead end. :-(

There is maybe hope for RTSP. The Android API Guides explicitly mention RTSP as a compatible format. Do you have any RTSP streams that you would like me to test?

sunng87 commented 8 years ago

@y20k Perhaps you can use rtsp://alive.rbc.cn/fm1006 for testing. I tested via mpv, it works:

 $ mpv rtsp://alive.rbc.cnfm1006                                                                
Playing: rtsp://alive.rbc.cn/fm1006
 (+) Audio --aid=1 (wmav2)
File tags:
 Artist: www.rbc.cn
 Title: 北京新闻广播
AO: [pulse] 32000Hz stereo 2ch float
A: 00:00:01
y20k commented 8 years ago

Okay. Thank you very much! I tried RTSP by adding a parser rule for "rtsp". Again with negative results :-( I am sorry.

I am not an audio expert. Both streams (mms and rtsp) seem to provide audio that was compressed using WMA2. So while the RTSP protocol seems to be supported by the MediaPlayer library, the WMA-codec maybe isn't. At least that is what I am thinking right now.

If that is really the case only the change to a new non-native playback library would solve this issue.

Screenshot from VLC playing rtsp://alive.rbc.cn/fm1006 vlc_rtsp

sunng87 commented 8 years ago

According to this answer wma2 is not supported by Android MediaPlayer.

I'm using TuneIn to play it at the moment but I found TuneIn is too heavy so I was looking for some alternatives and found transistor.

Thanks for your time on this issue.

y20k commented 8 years ago

You are welcome. Thank you in return for the excellent bug report! I am sorry that I cannot help you for now. I was using TuneIn, too. TuneIn was actually the reason why I started Transistor ;-).

Best wishes.