Difference between revisions of "Media"
Line 90: | Line 90: | ||
=== <translate>Events</translate> === | === <translate>Events</translate> === | ||
[[Special:MyLanguage/Event.MEDIA_RECEIVE|Event.MEDIA_RECEIVE]] ''(e.path) -- path to image''<br/><!-- Event.MEDIA_RECEIVE mediaReceive--> | [[Special:MyLanguage/Event.MEDIA_RECEIVE|Event.MEDIA_RECEIVE]] ''(e.path) -- path to image''<br/><!-- Event.MEDIA_RECEIVE mediaReceive--> | ||
− | [[Special:MyLanguage/Event.MEDIA_CANCEL|Event.MEDIA_CANCEL]] ''--user | + | [[Special:MyLanguage/Event.MEDIA_CANCEL|Event.MEDIA_CANCEL]] ''--user cancelled media input''<br/><!-- Event.MEDIA_CANCEL mediaCancel--> |
[[Special:MyLanguage/Event.VIDEO_COMPLETE|Event.VIDEO_COMPLETE]] ''--user completed watching video''<br/><!-- Event.VIDEO_COMPLETE videoComplete--> | [[Special:MyLanguage/Event.VIDEO_COMPLETE|Event.VIDEO_COMPLETE]] ''--user completed watching video''<br/><!-- Event.VIDEO_COMPLETE videoComplete--> | ||
Revision as of 03:12, 3 August 2019
Available since: Gideros ?
Description
- Get image from Camera, gallery or file system
- Resize image
- Make copy of an image
- Take screenshots
- Play videos (for cutscenes)
- Manipulate pictures (getting/setting pixels)
- And much more...
Examples
--require plugin
require "media"
-- is camera available
print(mediamanager:isCameraAvailable())
-- take screenshot (no permission needed)
mediamanager:takeScreenshot()
-- get picture from gallery (*need read permission*)
mediamanager:getPicture()
-- save picture to sdcard/pictures folder (*need write permission*)
mediamanager:postPicture("gfx/ball.png")
Notes
By resizing image you will actually resize the file of the image, so there is no going back to upscale it later.
getPicture method gives you copies of the image, so you won't harm the original.
The dimensions when resizing are all actual dimensions of the image and not logical dimensions in your project.
Methodsmediamanager:isCameraAvailable() -- returns true is you can get picture from camera Media.new(path) -- create new Media object with provided image |
EventsEvent.MEDIA_RECEIVE (e.path) -- path to image Constants |