Media

Status: Stable

Version: 0.56

What's new?

version 0.56
IOS Fixed Video playback in Landscape

About Media

Get images from Camera or gallery/file system
Resize the image or make copy of them. Take screenshots
Play videos for cutscenes
Manipulate pictures by getting/setting pixels
And much much more

Installation

Android
Copy libs folder into your exported project
Copy src folder into your exported project
Add System.loadLibrary("gmedia"); to your main activity
Add "com.giderosmobile.android.plugins.media.GMedia" as external class in your main activity
If your app will require Camera support add this to your manifest:
<uses-feature android:name="android.hardware.camera" android:required="true" />
If Camera support is only optional, add this to your manifest:
<uses-feature android:name="android.hardware.camera" android:required="false" />
If you need screenshots then add:
com.giderosmobile.android.plugins.media.GMedia.onDraw(gl);
inside public void onDrawFrame(GL10 gl) of class GiderosRenderer
IOS
Copy contents of Plugins directory into your exported project's Plugins directory
Add copied files to your Xcode project (Check create groups for added folders)
If you need screenshots then change:
[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO]
to YES
inside EAGLView.m method - (id)initWithFrame:(CGRect)rect
Windows and Mac
Copy contents of Plugins directory into your Gideros installation Plugins directory

Code example:

require "media"
mediamanager:addEventListener(Event.MEDIA_RECEIVE, function(e)
    local media = Media.new(e.path)
    media:resize(200, 200)
    print(media:getPixel(1, 1))
    for x = 50, 100 do
        for y = 50, 100 do
            media:setPixel(x, y, 255, 0, 0, 0.5)
        end
    end
    media:save()
    local bmp = Bitmap.new(Texture.new(e.path, true))
    stage:addChild(bmp) 
end)

if mediamanager:isCameraAvailable() then
    mediamanager:takePicture()
else
    mediamanager:getPicture()
end