Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Problems with Media Labs Plugins — Gideros Forum

Problems with Media Labs Plugins

lsouchetlsouchet Member
edited April 2014 in Plugins
Hello,
I started using the media plugin in the labs (http://giderosmobile.com/labs/media) to play an introduction video in may app.
I use media:playVideo() to display a video in fullscreen in mp4 format encoded with H264.
On Android, it was pretty straight forward and worked properly at first shot.
On iOS though, the behavior is not the same. My video is not correctly scaled (occupies about a quarter of the screen) and offset on the bottom left corner. It seems the video is not even exactly centered in the bottom left corner.

I tried with different resolutions videos and different screen sizes (iPhone 5, iPad mini so far) but the video is still too small and not centered in my screen.
I haven't been able to find much doc or support about this plugin even though it is marked as stable.

Any thoughts?

Thanks

Comments

  • ar2rsawseenar2rsawseen Maintainer
    @lsouchet interesting, can you email me the video, so I can play with it?

    to ar2rsawseen at gmail dot com
  • ar2rsawseenar2rsawseen Maintainer
    @lsouchet just a note that I did not forget about the issue and received your file, unfortunately I forgot Mac in the parent's house during the holiday and will drive back tomorrow to get it and check out the issue, sorry for delay ;)
  • keszeghkeszegh Member
    edited September 2015
    i thought i won't start a new thread, i cannot get media plugin to work (i try to do that on win export and win gideros player).
    my lua file is only one line:require "media"

    if i just copy the 4 dll's into "program files (x86)\gideros\plugins" i get the error (in both player and win export):
    main.lua:2: module 'media' not found:
    no field package.preload['media']
    no file '.\media.lua'
    no file 'C:\Program Files (x86)\Gideros\lua\media.lua'
    no file 'C:\Program Files (x86)\Gideros\lua\media\init.lua'
    no file 'C:\Program Files (x86)\Gideros\media.lua'
    no file 'C:\Program Files (x86)\Gideros\media\init.lua'
    no file '.\media.dll'
    no file 'C:\Program Files (x86)\Gideros\media.dll'
    no file 'C:\Program Files (x86)\Gideros\loadall.dll'

    if i copy the 4 dll's also into " 'C:\Program Files (x86)\Gideros" then i get:
    on exported exe:
    "The program can't start because mingwm10.dll is missing from your computer. Try reinstalling the program to fix this problem."
    on giderosplayer:
    "error loading module 'media' from file 'C:\Program Files (x86)\Gideros\media.dll':
    The specified module could not be found."

    maybe the media plugin is out of date since a lot of things changed in gideros? could it be updated? it has many important features. thanks

    (this problem i had already earlier and since then it never worked:
    http://giderosmobile.com/forum/discussion/5509/want-to-play-video-file-from-project-/p1 )
  • You need to copy them to plugins folder, but why 4 dlls? gmedia plugin is now 1 dll file
  • @ar2rsawseen, i thought i should use these:
    https://github.com/gideros/giderosplugins/tree/master/Media

    and that gmedia is some google service related stuff. nevertheless i tried it now with gmedia. if i require "media" as said in the install.html, that seems to be wrong, so i require "gmedia". we are one step further.
    now if i put it into plugins folder then it does not work, similar error as in my previous post, i don't know why it does not find as lfs etc. other plugins are found in plugins folder. anyway, i put gmedia.dll finally into gideros root folder and then i get the following error:
    "The program can't start because Qt5Multimedia.dll is missing from your computer. Try reinstalling the program to fix this problem."

    so what's next? (and thanks)
  • also if gmedia is a core plugin now and it's by definition in gideros installation then it should be listed here:
    http://docs.giderosmobile.com/reference/plugin
    there are other dll's in plugin folder that are not explained in the reference, like strict and clipper, so this way nobody will use them i guess. i get that referencing is a tedious job but without it its a wasted effort to add plugins.
  • Interesting, by this
    https://github.com/gideros/gideros/blob/master/plugins/gmedia/source/mediabinder.cpp#L1057

    it still should be require "media"

    and gmedia.dll should be in Plugins folder.

    It is possible that new media plugin requires some additional dll like you mentioned Qt5Multimedia.dll, which are not yet bundled with Gideros. Since I have qt installed I seem not to have any problems. I will try to determine if any additional are missing and let you know
  • Try copying this 3 files in your Gideros folder, but leave gmedia.dll in Plugins and require it as require "media"

    Will try to bundle Gideros with them next time
    zip
    zip
    media.zip
    316K

    Likes: bali001

    +1 -1 (+1 / -0 )Share on Facebook
  • that seems to work, clicking on many things in the media example project on gideros player on windows will make it crash though, but i think it's not a problem with the plugin but with the example.
    the get file from gallery serves almost as a file picker too.
  • getpicture on windows player gives the following error after choosing a file:
    call
    .../AppData/Local/Temp/gideros/mediafiles/20150923_122146_gideros.png
    media sizes	80	80
    255	255	255	0
    .../AppData/Local/Temp/gideros/Media/documents/20150923_122146_gideros.png: No such file or directory.
    stack traceback:
    	main.lua:63: in function <main.lua:25>
    for some reason media plugin saves a file not into the folder of the app but in a 'mediafiles' folder.
  • @ar2rsawseen, is this difference in folders with getpicture a bug? should i add it to the issues on github? or something else is wrong with my setup?
  • Better create an issue, so I won't forget to check it out later before release :)
  • Android video playback does not work in version 2015.09. Then I replace libgmedia.so with an earlier version of the plugin (0.56) and it works.
    I don't have the source of version 0.56 so I didn't find out what has changed.
    If anyone has that source code, please send me or upload here.

    Thanks,
    Balazs
  • The file_exists function returns false in playVideo method (mediabinder.cpp:654).
    If I replace file_exists with this (from @ar2rsawseen's comment: http://giderosmobile.com/forum/discussion/comment/37613#Comment_37607)
    static bool file_exists(const char *filename)
    {
    	bool exists = false;
    	G_FILE * pFile;
    	pFile = g_fopen(filename,"r");
    	if (pFile!=NULL)
    	{
    		exists = true;
    		g_fclose(pFile);
    	}
    	return exists;
    }
    then it returns true and player starts but it throws an error immediately:
    10-02 22:25:20.705: W/VideoView(9815): Unable to open content: test.mp4
    10-02 22:25:20.705: W/VideoView(9815): java.io.IOException: setDataSource failed.
    10-02 22:25:20.705: W/VideoView(9815): 	at android.media.MediaPlayer.setDataSource(MediaPlayer
    .java:1086)
    ...
    10-02 22:25:20.705: D/VideoView(9815): Error: 1,0
    10-02 22:25:22.937: E/MediaPlayer(9815): stop called in state 1
    10-02 22:25:22.937: E/MediaPlayer(9815): error (-38, 0)
    10-02 22:25:22.956: W/MediaPlayer(9815): mediaplayer went away with unhandled events
    ar2rsawseen mentioned this in an other comment:
    "Unfortunately this is the android limitation, that files can't be played form package.
     
    The solution is simple, I copy them over to Documents |D| directory and then pass 
    the g_pathForFile with "|D|" path inside"
    http://giderosmobile.com/forum/discussion/comment/37613#Comment_36419

    So when I copy the video file form asset to Documents it works.

    Someone using the video player or I am the only one? :)
  • Don't know how I missed that, applied same fix to Android, it now copies all files handled by gmedia to documents
  • bali001bali001 Member
    edited October 2015
    @ar2rsawseen: thanks for quick response!

    I tried the modified mediabinder.cpp.
    copyFile() called in init() when path does not exist, however init() called only in Media.new() lua function, isn't?
    mediamager:playVideo() does not fire init() so copyFile won't be called

    If I modify playVideo() and call copyFile directly it works fine.
    static int playVideo(lua_State *L)
    {
        GMediaManager *g = getInstance(L, 1);
        bool force = false;
        if(lua_isnoneornil(L, 3) == 0)
            force = lua_toboolean(L, 3);
        //const char* path = g_pathForFile(luaL_checkstring(L, 2));
        const char* originalPath = luaL_checkstring(L, 2);
        std::string path(g_pathForFile(originalPath));
        if(file_exists(path.c_str()))
        {
            int drive = gpath_getPathDrive(originalPath);
            if(drive == 0) {
                path = copyFile(path);
                const char* newPath = g_pathForFile(path.c_str());
                g->playVideo(newPath, force);
            }
        }
     
        return 0;
    }
Sign In or Register to comment.