Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
How do you make a link to a local .mov, .pdf, jpg file inside an app? — Gideros Forum

How do you make a link to a local .mov, .pdf, jpg file inside an app?

MellsMells Guru
edited August 2012 in General questions
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?
twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps

Comments

  • @atilim
    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).
    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
  • Hmm, interesting. Does phone use file associations at all? I mean like PC's.

    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
  • MellsMells Guru
    edited August 2012
    @ar2sawseen
    Only thing I wonder, if LuaFilesystem in the next release would help you in any way.
    I'll have to wait and seen, then :)

    What I want to do is this [ on ios ] (android later, but both form the beginning is even better) :
    image

    The user clicks and, by priority :
    1. Ideally the video is a local file played without leaving the app (with a video player and play controls)
    2. Or the video is an online file, and a player is embedded (youtube or vimeo)
    3. 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)
    4. 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.
    1. Any idea of how I could achieve priority 1?
    2. For priority 2, I got this great answer by @ianchia (Display html in my app) that I believe to be the only alternative?
    3. 3 and 4 : topic of this discussion. Seems to be impossible, wait until LuaFilesystem is available to check again.
    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
  • MellsMells Guru
    edited August 2012
    @ar2sawseen
    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.
    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
  • I would recommend a plugin as your best route - as you've seen in the UIKit plugin you can have controls on top of a gideros screen - I'd guess there would be a UIVideo control you could use quite easily.
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • @techdojo
    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.
    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
  • I come here for learning a way of making a link to a local .mov, .pdf, jpg file inside an app.
    Thank you all for giving ideas on it.
  • piepie Member
    @becofuan
    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:
    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)
    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.

Sign In or Register to comment.