Hi,
I am trying to
embed a video file in my app but for now I'm trying something a bit easier : create a link that lets the OS handle and open the file in its default app.
I have found this in the documentation for application:openUrl
application:openUrl(“http://www.giderosmobile.com”)
URL can be one of the http:, https:, tel:, or mailto: schemes.
But how do you make a link that points to a local .mov, .pdf, .jpg inside an app?
For example, the link would open a pdf file and the file would be handled by the os.
Same for a .mov file.
I have also checked
UrlLoader but it seems that it needs an internet connection to work.
Any idea?
Comments
Oh, I didn't expect this answer.
Is that a limitation of the Os? the framework?
Somebody that doesn't know much about all of that would think that it's part of the basics (like creating a link in html).
If it's an external file, and you open it through http it would probably offer you to download the file, only browsers that has specific plugins can open them directly, like when you open a PDF in browser - it opens Adobe. If you open mp3 in browser - it opens player. Don't know if mobile browsers have such things.
Or on the other hand, (if you don't use http and external file), there's probably a limitation, that you can't reference Gideros local file to access from external source, like video player app. (Meaning, that Gideros and Video player have different internal references to files).
Only thing I wonder, if LuaFilesystem in the next release would help you in any way.
But, yeah, it would be to open local files in external apps using file association and file: prototcol
What I want to do is this [ on ios ] (android later, but both form the beginning is even better) :
The user clicks and, by priority :
- Ideally the video is a local file played without leaving the app (with a video player and play controls)
- Or the video is an online file, and a player is embedded (youtube or vimeo)
- The video is a local file, a click on the image leads to a default app (chosen by the os) capable of opening the file (would make it work cross platform)
- and last, the video is an online file that is played through a default app (os dependent)
My current setup is a link that goes to a page of my site with the video embedded but it means that the video is not available offline. Ultimately, that's not what I want.http://www.giderosmobile.com/forum/discussion/1228/video-player-plugin#Item_14
From what I could understand it seems to be working good for Android (I'm developing for iOS).
I thought that creating a link to a local file was the easiest solution for my needs but it seems that the closest to what I want will be to stick with the only solution that seems to exist : UIKit.mm plugin (Gideros Wiki) modified by @ianchia.
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Ok I'll invest my time in learning how all of this works. I hope I can do it and maybe later learn how to create my own plugin.
Thank you all for giving ideas on it.
To embed videos you can use media plugin, while images can already be displayed in your app with Bitmap class.
A pdf needs to be handled from a pdf viewer, so you would need to open it in a pdf viewer, unless there is a plugin to handle it from gideros (which I don't recall).
As said from Arturs a couple of posts above: This would apply to pdf files too.
I am guessing, and I didn't test these: maybe you can try playing with
http://docs.giderosmobile.com/reference/gideros/UrlLoader#UrlLoader
and
http://docs.giderosmobile.com/reference/gideros/Application/openUrl#Application:openUrl
to see if you can tell your browser to download/open a pdf as it happens in html pages.
Or (not an elegant solution) you could try to set up an html local page (ie. file:///sdcard/app/linklist.html - which is opened by device browser) with links to pdf files that the browser can already handle.