Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Video Player Plugin — Gideros Forum

Video Player Plugin

zaniarzaniar Member
edited June 2012 in Plugins
Hi,
I want to create a video player plugin for Android. Anyone can help me with some guide? Are there some documentation I can read?

Ideally, I want the video behave like a Sprite. But, any clue about playing video on gideros is fine :)
Tagged:

Comments

  • Unfortunately, this isn't going to happen until render to texture functionality is added to the API. Currently there is no direct access to the raw texture data so although it is possible to decompress video to a buffer in memory, there is currently no way to apply that memory to a texture for it to be drawn. :(

    Render to texture is something that a couple of developers have been very vocal on and as such it will probably become a reality in a later release but nobody knows when.
  • The problem is that you don't have access to the Gideros display heirarchy from within a plugin. The best you could do is have a play window (which you could position, scale, resize etc) which would reside on top of the current display much like the way the UIKit plugin for iOS works.
    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
  • zaniarzaniar Member
    edited June 2012
    Thank you, @Scouser & @techdojo :)

    l guess the ideal implementation is not possible for now..

    I think I can use Android VideoView just like this tutorial (http://appcodingeasy.com/Gideros-Mobile/Gideros-Implementing-AdMob-for-Android)

    Wish me luck..
  • ScouserScouser Guru
    edited June 2012
    That should work, maybe with a user plugin to jump between Gideros and Java to add / remove the VideoView from the display hierarchy as and when required.
  • zaniarzaniar Member
    Progress report!
    I have successfuly play a video on gideros player using VideoView

    The next problem is:
    How to get JNIEnv in my plugin code?

    As far as I know, I need JNIEnv to call Java method from C/C++
  • ar2rsawseenar2rsawseen Maintainer
    Wow, do share. Tutorial, video, sample project, anything [-O<
  • Yeah I have been having the same trouble trying to write a plugin to use kiip.me in my games with Gideros.

    You may find this discussion interesting as it does mention how to get a hold of the JavaVM--and thus in turn call native functions from the plugin.

    http://www.giderosmobile.com/forum/discussion/comment/6793#Comment_6793

    Do lets us know how it works for you :)
    ThumbHurt Games / FB: ThumbHurt Games / FB: Eli/Teranth | Skype: teranth37
  • zaniarzaniar Member
    Wow.. thanks. I'll try it..
  • Do share how it works out for you :) I have been smashing my face on my keyboard over the calling Native Commands thing for a while playing with it.

    If I get a chance I was going to try and put together an example of Android Plugin Programming, since iOS seems to be getting most of the love at the moment--like droid more myself, currently my interest is in kiip.me working but I am guessing the JavaVM could be used for all sorts of things :)
    ThumbHurt Games / FB: ThumbHurt Games / FB: Eli/Teranth | Skype: teranth37
  • zaniarzaniar Member
    edited July 2012
    You can download my incomplete,quick, & dirty implementation below..

    https://dl.dropbox.com/u/19074677/Gideros/VideoPlugin.zip

    Make sure you change the value of LOCAL_SRC_FILES in Android.mk to match your environment

    https://dl.dropbox.com/u/19074677/Gideros/Player_EclipseProject.zip

    to show the video use..
    require("video")
    video.play()
    The idea is the same as @ar2rsawseen's tutorial (http://appcodingeasy.com/Gideros-Mobile/Gideros-Implementing-AdMob-for-Android). VideoView is placed on top of Gideros' mGLView when video.play() called.

    I got the audio played but no video. I suspect this issue is related with Giredos' renderer. So, I have mGLView removed before add VideoView to the layout. This trick fix the issue.

    It works fine before but it doesn't work recently :(. The player is crash whenever I call video.play().
    07-04 14:27:57.969: E/AndroidRuntime(22257): FATAL EXCEPTION: GLThread 14
    07-04 14:27:57.969: E/AndroidRuntime(22257): java.lang.CloneNotSupportedException: Class doesn't implement Cloneable
    07-04 14:27:57.969: E/AndroidRuntime(22257): 	at java.lang.Object.clone(Object.java:155)
    07-04 14:27:57.969: E/AndroidRuntime(22257): 	at com.giderosmobile.android.player.JavaNativeBridge.nativeDrawFrame(Native Method)
    07-04 14:27:57.969: E/AndroidRuntime(22257): 	at com.giderosmobile.android.player.JavaNativeBridge.onDrawFrame(JavaNativeBridge.java:341)
    07-04 14:27:57.969: E/AndroidRuntime(22257): 	at com.giderosmobile.android.GiderosRenderer.onDrawFrame(PlayerActivity.java:211)
    07-04 14:27:57.969: E/AndroidRuntime(22257): 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1388)
    07-04 14:27:57.969: E/AndroidRuntime(22257): 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)
  • @zaniar very cool, I will download it and let you know if I find anything useful out while playing with it :)
    ThumbHurt Games / FB: ThumbHurt Games / FB: Eli/Teranth | Skype: teranth37
  • @zaniar I found the issue I believe, apparently after android 2.3 came out, you MUST pair GetStaticObjectMethod() with CallStaticObjectMethod() or the system will flip out and throw this error.

    You need to update line number 32 in video.cpp to the following and it should work:
    (*env).CallStaticObjectMethod(cls, method);
    I was able to use this information to get my plugin working as well, hopefully this helps you with yours as well. Let me know if I can help any other way :)

    Notes: (I found out the issue isn't new some other people have been running into it as well, here is a guy that posted the answer: https://groups.google.com/group/android-ndk/tree/browse_frm/thread/71ac843f9ec586c7/f308bfcc23c10645?_done=/group/android-ndk/browse_frm/thread/71ac843f9ec586c7/f308bfcc23c10645?tvc=1&&amp;tvc=1&amp;pli=1)
    ThumbHurt Games / FB: ThumbHurt Games / FB: Eli/Teranth | Skype: teranth37
  • Can I call WebView to view web pages using this tech?
  • Hoo.. my old discussion :\"> It reminds me to complete this video plugin since I succesfully following @ar2rsawseen tutorial :-B

    @omer
    I think you can
  • Can you share your video plugin? The link fro dropbox is not working.
Sign In or Register to comment.