media.playVideo + RTSP

Anyone tried this? A URL I can open in VLC doesn’t seem to work on my device when I call it like this:

media.playVideo(“rtsp://myURL”, media.RemoteSource, false, onComplete)

Just a blank screen. I’ve also tried it without the baseSource parameter. I’m using build 922. Only tried on an iPhone 4S so far. [import]uid: 58455 topic_id: 35057 reply_id: 335057[/import]

I’m pretty sure RTSP works on Android. We added support for it sometime last year.
I personally haven’t RTSP video playback on an iOS device, but I thought it worked on that platform as well.

Perhaps the video you are trying to play is using a codec that iOS does not support?
Also, does the above RTSP URL work on your desktop browser?
[import]uid: 32256 topic_id: 35057 reply_id: 139403[/import]

Not from a browser, but from a downloaded VLC player on my laptop. Tried OPlayer on the iPhone and on my Samsung Galaxy with no luck. I believe the stream is mpeg2.

Do you know what build you added Android support in? [import]uid: 58455 topic_id: 35057 reply_id: 139404[/import]

I believe the last 2 Corona releases supported RTSP on Android via media.playVideo().
If it’s not working for you, then it sounds like a codec issue and you’ll have to encode your video using a different format. [import]uid: 32256 topic_id: 35057 reply_id: 139406[/import]

I’ll talk to my client about the video format.

On a tangential note, why is os.execute() not available on devices? Another thought was to launch a VLC player with a system call, but that doesn’t appear to be an option. [import]uid: 58455 topic_id: 35057 reply_id: 139409[/import]

>> why is os.execute() not available on devices?

Because Apple will reject iOS apps that launch executable code.
See Apple’s store review guidelines, bullet #2.8:
https://developer.apple.com/appstore/resources/approval/guidelines.html#functionality
[import]uid: 32256 topic_id: 35057 reply_id: 139427[/import]

I didn’t see anything in the Corona sdk doc about rtsp on IOS.
Your statement is only partially true, apps can launch other apps using a custom url scheme.
So they can be launched using a url such as rtsp:// .

Of course unless the app is one of the group of apps allowed to run background it must now suspend itself. It may be possible to kind of do a round robin back to the corona app after the video player is done. But ideally if corona can do a shouldStartLoadRequest from a webview then rtsp should be easy
to add to the framework.

http://stackoverflow.com/questions/13186245/can-an-iphone-ipad-app-embed-a-browser-that-can-play-rtsp-stream-using-an-html5/13186544#13186544

http://streammore-tv.tumblr.com/post/34794206547/welcome

Personally I am still exploring Corona to see if its any use for us.

[import]uid: 215376 topic_id: 35057 reply_id: 139494[/import]

Launching another app via a URL request is different, because you are launching an Apple reviewed/approved app via the operating system. That is, the OS is hunting down an app matching the given URL scheme and then launches it. Now, launching an app via the shell is definitely not allowed, which is what [lua]os.execute()[/lua] does. Apple documents this in their guidelines which I provided a link to up above. I believe Apple’s intent is to prevent app bundles from including executables that run in the background and outside of the OS’ tight control so to speak.

You can create a [lua]UIWebView[/lua] via Corona’s [lua]native.newWebView()[/lua] API.
http://docs.coronalabs.com/api/library/native/newWebView.html

You also have the ability to set up an event listener with a web view in Corona to be notified when a new URL is about to be loaded, where you can override its handling and play an RTSP URL via a video player.

First, I would recommend that you give it a try via our [lua]media.playVideo()[/lua] API, because doing it via a WebView adds a bit more complexity.
[import]uid: 32256 topic_id: 35057 reply_id: 139508[/import]

I’m pretty sure RTSP works on Android. We added support for it sometime last year.
I personally haven’t RTSP video playback on an iOS device, but I thought it worked on that platform as well.

Perhaps the video you are trying to play is using a codec that iOS does not support?
Also, does the above RTSP URL work on your desktop browser?
[import]uid: 32256 topic_id: 35057 reply_id: 139403[/import]

Not from a browser, but from a downloaded VLC player on my laptop. Tried OPlayer on the iPhone and on my Samsung Galaxy with no luck. I believe the stream is mpeg2.

Do you know what build you added Android support in? [import]uid: 58455 topic_id: 35057 reply_id: 139404[/import]

I believe the last 2 Corona releases supported RTSP on Android via media.playVideo().
If it’s not working for you, then it sounds like a codec issue and you’ll have to encode your video using a different format. [import]uid: 32256 topic_id: 35057 reply_id: 139406[/import]

I’ll talk to my client about the video format.

On a tangential note, why is os.execute() not available on devices? Another thought was to launch a VLC player with a system call, but that doesn’t appear to be an option. [import]uid: 58455 topic_id: 35057 reply_id: 139409[/import]

>> why is os.execute() not available on devices?

Because Apple will reject iOS apps that launch executable code.
See Apple’s store review guidelines, bullet #2.8:
https://developer.apple.com/appstore/resources/approval/guidelines.html#functionality
[import]uid: 32256 topic_id: 35057 reply_id: 139427[/import]

I didn’t see anything in the Corona sdk doc about rtsp on IOS.
Your statement is only partially true, apps can launch other apps using a custom url scheme.
So they can be launched using a url such as rtsp:// .

Of course unless the app is one of the group of apps allowed to run background it must now suspend itself. It may be possible to kind of do a round robin back to the corona app after the video player is done. But ideally if corona can do a shouldStartLoadRequest from a webview then rtsp should be easy
to add to the framework.

http://stackoverflow.com/questions/13186245/can-an-iphone-ipad-app-embed-a-browser-that-can-play-rtsp-stream-using-an-html5/13186544#13186544

http://streammore-tv.tumblr.com/post/34794206547/welcome

Personally I am still exploring Corona to see if its any use for us.

[import]uid: 215376 topic_id: 35057 reply_id: 139494[/import]

Launching another app via a URL request is different, because you are launching an Apple reviewed/approved app via the operating system. That is, the OS is hunting down an app matching the given URL scheme and then launches it. Now, launching an app via the shell is definitely not allowed, which is what [lua]os.execute()[/lua] does. Apple documents this in their guidelines which I provided a link to up above. I believe Apple’s intent is to prevent app bundles from including executables that run in the background and outside of the OS’ tight control so to speak.

You can create a [lua]UIWebView[/lua] via Corona’s [lua]native.newWebView()[/lua] API.
http://docs.coronalabs.com/api/library/native/newWebView.html

You also have the ability to set up an event listener with a web view in Corona to be notified when a new URL is about to be loaded, where you can override its handling and play an RTSP URL via a video player.

First, I would recommend that you give it a try via our [lua]media.playVideo()[/lua] API, because doing it via a WebView adds a bit more complexity.
[import]uid: 32256 topic_id: 35057 reply_id: 139508[/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]