Quick Links: Gideros Home | Download Gideros | Developer Guide
GMedia plugin on Android
  • I build a player from Android Studio and use Media to play a video. When I use the player the video plays fine. When I export the game (assets only) into the same Android Studio project I get this error and a warning popup saying “Can’t play this video”:
    10-07 19:38:39.998 4519-4519/com.totebo.fastfoodrampage W/MediaPlayer: Couldn't open file on client side; trying server side: java.io.FileNotFoundException: No content provider: video/AG_Amend_05_03_2016.mov
    10-07 19:38:40.027 4519-4519/com.totebo.fastfoodrampage W/VideoView: Unable to open content: video/AG_Amend_05_03_2016.mov


    When I play the video in the player this pops up, but the video plays:
    10-07 19:54:01.597 26416-26416/com.totebo.fastfoodrampage W/MediaPlayer: Couldn't open file on client side; trying server side: java.io.FileNotFoundException: No content provider: /storage/emulated/0/gideros/Fast Food Rampage/resource/video/AG_Amend_05_03_2016.mov


    Any ideas why this would happen?
    My Gideros games: www.totebogames.com
  • pie +1 -1
    Member
    Did you try with another file format/container?
    https://developer.android.com/guide/appendix/media-formats.html
  • Yes, I get the same result with mp4. But since the video works fine in the Gideros player, what's causing it not to work when exported?
    My Gideros games: www.totebogames.com
  • ar2rsawseenar2rsawseen +1 -1 (+1 / -0 )
    Maintainer
    @totebo
    I think it was something related with apk packaging, you can't play video from resources, but need to copy it to documents folder and play from there

    Likes: totebo

  • That's great info, but very unexpected! How would I copy the video? With Lua or with Java (please say Lua). :)
    My Gideros games: www.totebogames.com
  • pie +1 -1
    Member
    lua :) try this:
    function copyResource(src, dst)
    local srcf = io.open(src, "rb")
    local dstf = io.open(dst, "wb")
    local size = 2^13 -- good buffer size (8K)
    while true do
    local block = srcf:read(size)
    if not block then break end
    dstf:write(block)
    end
    srcf:close()
    dstf:close()
    end


    but I never used it to copy to documents, I know it works to copy into resources.
  • There was also great examples similarly on sqlite plugin:
    http://docs.giderosmobile.com/reference/plugin/sqlite3#sqlite3

    cause it has same problem on Android
  • Thanks guys. So in my case I need to display a video once every time the game is loaded, as a splash screen. Would I need to copy it every time, or is there a way of checking if the file is already there?
    My Gideros games: www.totebogames.com
  • pie +1 -1
    Member
    Files inside |D| shouldn't be removed until the app is removed, theoretically you just need to check if file_exists()
    Did the previous function work to copy to |D|?
    function file_exists(name) --return true if file exists
    local f=io.open(name,"r")
    if f~=nil then io.close(f) return true else return false end
    end

  • keszegh +1 -1
    Member
    @ar2rsawseen, i hope everything is fine with you, as i've noticed that you did not post on the forum for a long while (and i hope you do not mind asking publicly in the forum).

    now back to the topic, I realized this may be a better topic for the humble request i posted in another topic, so let me repeat:
    i realized that the media plugin is almost good for saving/loading file with dialog on desktop.

    -for loading mediamanager:getPicture() would be perfect, except that it forces you given file extensions. can you make a mediamanager:getFile() version? i guess it should be really simple.

    -for saving mediamanager:postPicture() is perfect, there you can already use it to save any file extension (or even change the extension), which is good. the only problem is that it opens the folder where the file to save is located, which is the working directory of fragmenter in my case, not so nice. there should be an option to set the initial directory (as i would set it to the root or if this is not the first time one saves a file then the previous folder he has chosen) - this applies to the previous getPicture/getFile too of course.
    probably such a saving method should be called mediamanager:postFile() or something to make it clear that it's not just for pictures.

    -ideally i'd like to load multiple files with such native dialog, in case that's easy to add.

    i hope i do not ask for much, thanks
  • keszegh +1 -1
    Member
    @ar2rsawseen, i've tried to add the methods saveFile and getFile to the media plugin, i've sent a merge request.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID

In this Discussion

Top Posters