media.playVideo + RTSP

I just tested the above link on the following devices.

  • Samsung Galaxy Nexus running Android 4.0.4 (Worked)
  • Nook Tablet running Android 2.3 (Worked)
  • 1st generation Kindle Fire running Android 2.3 (Worked)
  • Kindle Fire HD 7" running Android 4.0.4 (Failed)

So, out of the 4 devices above, it only failed to load on one of them. Most likely due to a codec issue, which is out of our control. Some of them showed a black screen initially because it took a while to load, but they eventually played the video. On the one device that it failed on, an error message was immediately displayed stating that the video could not be played.

I know on Android, the supported codecs can really vary between devices. The only way to make video playback work reliably is to record the video yourself encoded in a format that is available on as many devices as possible. That’s the best you can shoot for. In my experience, MP4 and M4V formats have worked on all devices that I’ve tested with. If the encoding of the RTSP videos are out of your control, then it doesn’t sound they’re an option for you on mobile devices. In any case, I don’t see this as a Corona issue since we really only pass the URL over to the OS’ video player.
[import]uid: 32256 topic_id: 35057 reply_id: 140933[/import]

First off, thanks for the quick responses, Joshua. People like you and Peach make the Corona experience that much more enjoyable.

I agree, not a Corona issue. I either need to find players that work on my devices, or get my client to change the format they stream. [import]uid: 58455 topic_id: 35057 reply_id: 140951[/import]

rtsp://v1.cache6.c.youtube.com/CjYLENy73wIaLQmV-JujNd-OhxMYJCAkFEIJbXYtZ29vZ2xlSARSBXdhdGNoYOqWqLywkKXrSAw=/0/0/0/video.3gp

Thats one strange little video , one thing to point out is that this is a udp stream not a htpp stream , does Corona support udp rtsp streams like those that come from youtube.

The above played on an iPhone 4s with a video player based on ffmpeg decoding. [import]uid: 215376 topic_id: 35057 reply_id: 140955[/import]

Sorry about the weird/freaky video. :slight_smile:
Someone else gave me that URL to test with.

On Android, all we do is hand over the URL to the standard Android VideoView in Java. From there, it is up to Android (Google’s implementation) to download/stream and play the video onscreen. We do pretty much the same on iOS.
http://developer.android.com/reference/android/widget/VideoView.html

Michelle brings up a good point about UDP. Dave, perhaps your wireless router has a firewall set up that is blocking UDP packets?
In any case, I thought using UDP over the Internet has been frowned upon by Internet Service Providers. Probably should avoid it.

Here’s another possible solution. Android’s WebView does support Flash. You could try doing a live video stream via Flash instead. Of course, the limitation being that iOS does not support it.

You can also have a look at the Android log when try to load the RTSP video. See if any interesting errors pop up. If you think we’re doing something wrong, then please let us know. Other than that, I’m starting to run out of ideas. [import]uid: 32256 topic_id: 35057 reply_id: 140964[/import]

Thanks, again. Don’t think UDP is the problem since I can see the video in the simulator, and my MacBook is connected to the same router. Also, my client’s stream is coming from a closed network over which I already receive UDP packets for the basic functionality of the app (Predictive iDash).

I’ll check out the Flash option for Android as well as the logs.

p.s. I agree - weird video :slight_smile: [import]uid: 58455 topic_id: 35057 reply_id: 140973[/import]

No luck with the native.newWebView(). I can access the stream from the browser on Android by selecting VLC, which I downloaded from Videolan, when it prompts for the video player to use. I set this as default, but when I try to load the web view from my app, it simply says it can’t open the web page. It doesn’t look like it’s trying to load the player. [import]uid: 58455 topic_id: 35057 reply_id: 140699[/import]

You should use [lua]media.playVideo()[/lua] instead. I know that API supports RTSP. I’ve tested it for myself.

The [lua]native.newWebView()[/lua] does not currently support videos on Android. Although, it does support it on iOS. Android’s Java WebView class does not come with free video playback support, unlike iOS. [import]uid: 32256 topic_id: 35057 reply_id: 140702[/import]

I’ve already tried that. The first post in the thread shows my code. Just tried it again with the web view on iOS and it just shows a gray screen. Using media.playVideo() on Android shows a black screen.
[import]uid: 58455 topic_id: 35057 reply_id: 140708[/import]

Your RTSP audio/video is likely encoded in a format that the device does not support. You need to link to a different format, such as 3GP.

I’ve just tested the following on my Android device and it worked…
[lua]media.playVideo(“rtsp://v1.cache6.c.youtube.com/CjYLENy73wIaLQmV-JujNd-OhxMYJCAkFEIJbXYtZ29vZ2xlSARSBXdhdGNoYOqWqLywkKXrSAw=/0/0/0/video.3gp”, media.RemoteSource, true)[/lua]
[import]uid: 32256 topic_id: 35057 reply_id: 140789[/import]

Huh. That worked from the simulator, but not my iPhone 4s or Galaxy Samsung tablet. Maybe neither of my devices supports that format, either. [import]uid: 58455 topic_id: 35057 reply_id: 140901[/import]

I just tested the above link on the following devices.

  • Samsung Galaxy Nexus running Android 4.0.4 (Worked)
  • Nook Tablet running Android 2.3 (Worked)
  • 1st generation Kindle Fire running Android 2.3 (Worked)
  • Kindle Fire HD 7" running Android 4.0.4 (Failed)

So, out of the 4 devices above, it only failed to load on one of them. Most likely due to a codec issue, which is out of our control. Some of them showed a black screen initially because it took a while to load, but they eventually played the video. On the one device that it failed on, an error message was immediately displayed stating that the video could not be played.

I know on Android, the supported codecs can really vary between devices. The only way to make video playback work reliably is to record the video yourself encoded in a format that is available on as many devices as possible. That’s the best you can shoot for. In my experience, MP4 and M4V formats have worked on all devices that I’ve tested with. If the encoding of the RTSP videos are out of your control, then it doesn’t sound they’re an option for you on mobile devices. In any case, I don’t see this as a Corona issue since we really only pass the URL over to the OS’ video player.
[import]uid: 32256 topic_id: 35057 reply_id: 140933[/import]

First off, thanks for the quick responses, Joshua. People like you and Peach make the Corona experience that much more enjoyable.

I agree, not a Corona issue. I either need to find players that work on my devices, or get my client to change the format they stream. [import]uid: 58455 topic_id: 35057 reply_id: 140951[/import]

rtsp://v1.cache6.c.youtube.com/CjYLENy73wIaLQmV-JujNd-OhxMYJCAkFEIJbXYtZ29vZ2xlSARSBXdhdGNoYOqWqLywkKXrSAw=/0/0/0/video.3gp

Thats one strange little video , one thing to point out is that this is a udp stream not a htpp stream , does Corona support udp rtsp streams like those that come from youtube.

The above played on an iPhone 4s with a video player based on ffmpeg decoding. [import]uid: 215376 topic_id: 35057 reply_id: 140955[/import]

Sorry about the weird/freaky video. :slight_smile:
Someone else gave me that URL to test with.

On Android, all we do is hand over the URL to the standard Android VideoView in Java. From there, it is up to Android (Google’s implementation) to download/stream and play the video onscreen. We do pretty much the same on iOS.
http://developer.android.com/reference/android/widget/VideoView.html

Michelle brings up a good point about UDP. Dave, perhaps your wireless router has a firewall set up that is blocking UDP packets?
In any case, I thought using UDP over the Internet has been frowned upon by Internet Service Providers. Probably should avoid it.

Here’s another possible solution. Android’s WebView does support Flash. You could try doing a live video stream via Flash instead. Of course, the limitation being that iOS does not support it.

You can also have a look at the Android log when try to load the RTSP video. See if any interesting errors pop up. If you think we’re doing something wrong, then please let us know. Other than that, I’m starting to run out of ideas. [import]uid: 32256 topic_id: 35057 reply_id: 140964[/import]

Thanks, again. Don’t think UDP is the problem since I can see the video in the simulator, and my MacBook is connected to the same router. Also, my client’s stream is coming from a closed network over which I already receive UDP packets for the basic functionality of the app (Predictive iDash).

I’ll check out the Flash option for Android as well as the logs.

p.s. I agree - weird video :slight_smile: [import]uid: 58455 topic_id: 35057 reply_id: 140973[/import]

Sorry for bumping an old thread but I’m experiencing a similar problem. I’m trying to play a youtube 3gp video using media.playVideo() but the video player keeps crashing on the device. On the simulator it works fine but on an iPhone 4S, iPhone 5 and iPad 3 it crashes without being able to start the video.

My code is rather simple too, I can’t figure out what could be causing this:

media.playVideo('rtsp://v8.cache1.c.youtube.com/CigLENy73wIaHwm4pMZdrDxvXhMYDSANFEgGUgx1c2VyX3VwbG9hZHMM/0/0/0/video.3gp', media.RemoteSource, true)

Anyone having the same problem?

Sorry for bumping an old thread but I’m experiencing a similar problem. I’m trying to play a youtube 3gp video using media.playVideo() but the video player keeps crashing on the device. On the simulator it works fine but on an iPhone 4S, iPhone 5 and iPad 3 it crashes without being able to start the video.

My code is rather simple too, I can’t figure out what could be causing this:

media.playVideo('rtsp://v8.cache1.c.youtube.com/CigLENy73wIaHwm4pMZdrDxvXhMYDSANFEgGUgx1c2VyX3VwbG9hZHMM/0/0/0/video.3gp', media.RemoteSource, true)

Anyone having the same problem?