Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Gideros Labs - Page 6 - Gideros Forum

Gideros Labs

12346

Comments

  • ar2rsawseenar2rsawseen Maintainer
    @bali001 yep sorry, it seems playing video is not available in Dekstops, I could not get the way around codec problems.

    But it should work on IOS and Android for mp4 files.
  • bali001bali001 Member
    edited March 2014
    @ar2rsawseen thanks

    Unfortunately only iOS works for me, on Android(emulator and device) there is an error:
    D/Gideros(27732): File does not exist
    D/Gideros(27732): stack traceback:
    D/Gideros(27732): ...assets/assets/main.lua.jet:116: in main chunk

    main.lua:116 => local media = Media.new("ball.png")
  • ar2rsawseenar2rsawseen Maintainer
    hmm, is your file really ball.png and not ball.PNG for example, as Android file system is case sensitive.

    Because I just tried the exported project and gideros player on Android and all seems to work, opening image files
  • ar2rsawseenar2rsawseen Maintainer
    Updated Gaming Interface
    version 0.4
    (Android) GameCircle fixed callback null pointer
    (Android) GameCircle fixed destroying in Gideros Player
    (Android) Google play fixed login null pointer
    (Android) Fixed dispatching loadState on update
    (Android) Google play key check and max results check
    (IOS) Initial version with GameCenter and iCloud support

    Likes: SinisterSoft

    +1 -1 (+1 / -0 ) Share on Facebook
  • @ar2rsawseen I just tried on gideros playeron on Android, but it didn't start:
    main.lua:2: module 'media' not found:
    no field package.preload['media']
    no file './media.lua'
    no file '/usr/local/share/lua/5.1/media.lua'
    no file '/usr/local/share/lua/5.1/media/init.lua'
    no file '/usr/local/lib/lua/5.1/media.lua'
    no file '/usr/local/lib/lua/5.1/media/init.lua'
    no file './media.so'
    no file '/usr/local/lib/lua/5.1/media.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
    stack traceback:
    main.lua:2: in main chunk

    Added ligmedia.so to project (as media.so), another error:
    error loading module 'media' from file './media.so':
    dynamic libraries not enabled; check your Lua installation

    Did I forget something while install?

    thanks and sorry for newbie questions :)
  • ar2rsawseenar2rsawseen Maintainer
    @bali001 the file should be named libgmedia.so
    but in the activity you should put:
    System.loadLibrary("gmedia");
    and
    "com.giderosmobile.android.plugins.media.GMedia",
    ;)
  • bali001bali001 Member
    edited March 2014
    @ar2rsawseen thanks!

    The module error ("module 'media' not found") occurs when I try to run through Gideros Studio (with remote player on Android)

    When I try to run it through Eclipse another error occurs (I mentioned earlier): it can't find file "ball.png"

    I made some modification to the example lua file:
    local bmp = Bitmap.new(Texture.new("ball.png", false))
    In this case there is no problem with "ball.png" (it displayed)

    But the original doesn't work:
    local media = Media.new("ball.png")
    local bmp = Bitmap.new(Texture.new(media:getPath(), true))
    It seems that the Media.New() does not search the files in the same folder as where it was called
    at least in my case

    and it works on iOS... :-O
  • ar2rsawseenar2rsawseen Maintainer
    ok so there must be something with paths, althought they are on platform independed part of the code

    So the problem is when not using as player but as exported app, right? will recheck that case
  • Yes, when using as exported app. Thanks
  • ar2rsawseenar2rsawseen Maintainer
    edited April 2014
    @SinisterSoft not sure if I want to talk to you about that on 1st of April :D

    Especially, not sure if you want me to answer you on 1st of April, not after what you've done :))

    Likes: SinisterSoft

    +1 -1 (+1 / -0 ) Share on Facebook
  • @ar2rsawseen I modified /removed these lines in main.lua so it works on Android (as exported project) but when I select a picture from the gallery it crashes. Logcat:
    /data/data/hu.progart.mediatest/files/20140402_061149_gideros.png: No such file or directory.
    <img class="emoji" src="/resources/emoji/anguished.png" title="D:" alt="D:" height="20" />/Source/smartphone/gideros/_builds/Media/assets/assets/main.lua.jet:63: in function <D:/Source/smartphone/gideros/_builds/Media/assets/assets/main.lua.jet:25>
    main.lua:63 => bmp = Bitmap.new(Texture.new(media:getPath(), true))
    I guess this is the same problem as above

    And "Play Video" does nothing
    I added a "print" to playVideo method in GMedia.java but no entry in logcat

    Have you any idea? :)

    Thanks
  • ar2rsawseenar2rsawseen Maintainer
    Yes true, something is different on Android app (not player)
    I will debug more tomorrow

    Basically problem is accessing files in |R| (Resource) directory and it seems to be something Android specific

    Same way probably a video file can't be played, because it can't find it.
  • ar2rsawseenar2rsawseen Maintainer
    @bali001 I've fixed the issue, please try downloading it again from Gideros Labs ;)

    Likes: SinisterSoft

    +1 -1 (+1 / -0 ) Share on Facebook
  • @ar2rsawseen Thx, works like a charm! :) :beer:
  • ar2rsawseenar2rsawseen Maintainer
    Updated Gaming Interface:

    version 0.5
    IOS Fixed achievement caching
    IOS Prevents submiting same achievement more than 1 time
    Google Play fixed resolving connection bug

    Likes: SinisterSoft

    +1 -1 (+1 / -0 ) Share on Facebook
  • @ar2rsawseen (were the android changes already done in a previous update, maybe today? - there were no file size changes).
  • ar2rsawseenar2rsawseen Maintainer
    Updated Facebook plugin,
    v0.5
    fixed apprequests returning as canceled
    and added returning request or post id as response parameter to dialog complete event

    Likes: SinisterSoft

    +1 -1 (+1 / -0 ) Share on Facebook
  • On OSX I've added the media libs to the plugins folder and keep getting an error when trying to run the emulator with require('media')...

    module 'media' not found:
    no field package.preload['media'
    .
    .
    .

    Any ideas?
  • bali001bali001 Member
    edited April 2014
    Basically problem is accessing files in |R| (Resource) directory and it seems to be something Android specific

    Same way probably a video file can't be played, because it can't find it.
    Off

    I would like to play a video file (but not in fullscreen). I created a plugin based on your media plugin and but I ran the same problem as above.
    I've tried g_pathForFile in two different ways, but failed:
    const char *originalPath = luaL_checkstring(L, 1);
    originalPath = g_pathForFile(originalPath);
    video_playVideo(originalPath)
    and
    const char *originalPath = luaL_checkstring(L, 1);
    std::string path(g_pathForFile(originalPath));
    video_playVideo(g_pathForFile(path.c_str()));
    Please tell me how did you solve it? [-O<

    /Off
  • ar2rsawseenar2rsawseen Maintainer
    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
  • The solution is simple, I copy them over to Documents |D| directory and then pass the g_pathForFile with "|D|" path inside
    Thanks! You saved my hair, again! :D
  • @ar2rsawseen: With the labs facebook plugin I'm grabbing a list of all friends with some extra fields to see if the have the app installed and what score they have (the normal scores just returns a list of top 20 scores). Facebook appears to be splitting the information into 'pages'. Using the plugin how do you cope with the pages?

    here is the call:
    facebook:get("/me/friends",{fields="id,name,installed,score"})

    here is a sample of the data (a number or two has been changed to protect the innocent):

    {.....loads of easy to figure table data then... ,"paging":{"next":"https:\/\/graph.facebook.com\/1268113038\/friends?fields=id,name,installed,score&format=json&access_token=CAxxxxxxxxxxxxxYAZDZD&limit=5000&offset=5000&__after_id=enc_Aexi8UJmuxxxxxx"}}

  • bali001bali001 Member
    with the Media iOS plugin example app crashes after video stops (through Xcode, on iOS simulator)
    I commented a line [self.Alayer release] from 'GMediaView stop' (GMediaClass.mm) method and it works
    -(void)stop{
        if(self.Alayer != nil)
        {
            [self.Alayer removeFromSuperlayer];
            //[self.Alayer release];
            self.Alayer = nil;
        }
        if(self.player != nil){
            [self.player pause];
            [self.player release];
            self.player = nil;
        }
        if([self superview]!=nil)
        {
            [self removeFromSuperview];
        }
    }
    I couldn't test on device :(
  • bali001bali001 Member
    edited June 2014
    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
    I made a simple plugin based on your Media plugin which plays a video in a specific size. In this plugin I use your copyfile function (from iOS mediabinder.cpp) on Android but my test app randomly chrashes while playing a video.

    Error
    #00  pc 00009830  /data/.../libgvfs.so (g_feof+52)
    #01  pc 00005c58  /data/.../libvideo.so (copyFile(std::string)+576)
     stack:
    7592f448  755b1410  /data/.../libgvfs.so
    7592f44c  755b0f5c  /data/.../libgvfs.so
    7592f450  755b1410  /data/.../libgvfs.so
    7592f454  755b0f5c  /data/.../libgvfs.so
    7592f458  00000008  
    7592f45c  7cda5d5c  [anon:libc_malloc]
    7592f460  7592f564  [stack:3092]
    7592f464  7559b440  /data/.../libgvfs.so (g_p_open+24)
    7592f468  7559afe0  /data/.../libgvfs.so (g_fopen+72)
    7592f46c  00000241  
    7592f470  000001ed  
    7592f474  755b11a8  /data/.../libgvfs.so
    7592f478  7559bca0  /data/.../libgvfs.so (gpath_join+84)
    7592f47c  00000241  
    7592f480  7592f560  [stack:3092]
    7592f484  7592f560  [stack:3092]
    #00  7592f488  75599af8  /data/.../libgvfs.so (__sclose)
    7592f48c  7592f560  [stack:3092]
    7592f490  00000000  
    7592f494  757f9c5c  /data/.../libvideo.so (copyFile(std::string)+580)
    copyfile function:
    std::string copyFile(std::string path){
    	//check extension if should be copied
    	const char *ext = strrchr(path.c_str(), '.');
    	if (ext)
    		ext++;
    	//glog_d("Ext: %s", ext);
    	if (!strcasecmp(ext, "jpeg") ||
    		!strcasecmp(ext, "jpg") ||
    		!strcasecmp(ext, "png") ||
    		!strcasecmp(ext, "wav") ||
    		!strcasecmp(ext, "mp4") ||
    		!strcasecmp(ext, "lua"))
    	{
    		//get file name
    		const char *filename = strrchr(path.c_str(), '/');
    		if(filename == NULL){
    			filename = strrchr(path.c_str(), '\\');
    			if(filename == NULL){
    				filename = strrchr(path.c_str(), '|');
    				if(filename == NULL){
    					filename = path.c_str();
    				}
    				else
    					filename++;
    			}
    			else
    				filename++;
    		}
    		else
    			filename++;
    		std::string copyPath = std::string("|D|") + std::string(filename);
     
    		//check maybe file exists already exists
    		if(!file_exists(g_pathForFile(copyPath.c_str())))
    		{
    			glog_d("Copy file to document directory: %s", copyPath.c_str());
    			G_FILE *filer = g_fopen(path.c_str(), "rb");
    			G_FILE *filew = g_fopen(copyPath.c_str(),"wb");
     
    			char buffer[100];
    			int numr,numw;
    			while(g_feof(filer)==0){
    				if((numr=g_fread(buffer,1,100,filer))!=100){
    					if(g_ferror(filer)!=0){
    						g_fprintf(g_stderr,"read file error.\n");
    						exit(1);
    					}
    					else if(g_feof(filer)!=0);
    				}
    				if((numw=g_fwrite(buffer,1,numr,filew))!=numr){
    					g_fprintf(g_stderr,"write file error.\n");
    					exit(1);
    				}
    			}
    			g_fclose(filer);
    			g_fclose(filew);
    		}
    		return copyPath;
    	}
    	return path;
    }
    Have some idea of what could be the problem?

    Thanks
  • ar2rsawseenar2rsawseen Maintainer
    hmm, probably I have updated something for Android, here's an Android version:
    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;
    }
     
    static std::string copyFile(std::string path){
        //check extenstion if should be copied
            //get file name
            const char *filename = strrchr(path.c_str(), '/');
            if(filename == NULL){
                filename = strrchr(path.c_str(), '\\');
                if(filename == NULL){
                    filename = strrchr(path.c_str(), '|');
                    if(filename == NULL){
                        filename = path.c_str();
                    }
                    else
                        filename++;
                }
                else
                    filename++;
            }
            else
                filename++;
            std::string copyPath = std::string("|D|") + std::string(filename);
     
            //check maybe file exists already exists
            if(!file_exists(g_pathForFile(copyPath.c_str())))
            {
     
                G_FILE *filer = g_fopen(path.c_str(), "rb");
                G_FILE *filew = g_fopen(copyPath.c_str(),"wb");
     
                char buffer[100];
                int numr,numw;
                while(g_feof(filer)==0){
                    if((numr=g_fread(buffer,1,100,filer))!=100){
                        if(g_ferror(filer)!=0){
                            g_fprintf(g_stderr,"read file error.\n");
                            exit(1);
                        }
                        else if(g_feof(filer)!=0);
                    }
                    if((numw=g_fwrite(buffer,1,numr,filew))!=numr){
                        g_fprintf(g_stderr,"write file error.\n");
                        exit(1);
                    }
                }
                g_fclose(filer);
                g_fclose(filew);
            }
            return copyPath;
    }
  • Thx! It seems my problem is with the original video path >:(, so I modified my plugin: if original file does not exist copyFile won't be called.
Sign In or Register to comment.