28 October 2013
Daily Build Roundup: Select/Capture Video + iTunes Library Access
We’ve added some media goodies to the latest daily builds! The following are available as of 2013.1244.
Videos (and Photos)
In the latest daily builds, you now have the ability to select and capture videos. Instead of adding even more complexity to media.show(), we decided it was time to deprecate that function in favor of newer and cleaner APIs.
Our goal here was to distinguish between selecting media versus capturing media. In both cases, a native UI provided by the OS is presented.
To select a video, simply call the new media.selectVideo() function and the native UI interface for selecting a video from the device’s catalog comes up:
1 2 3 4 5 6 7 8 9 10 |
local function onComplete(event) if event.completed then media.playVideo(event.url) end end if media.hasSource( media.PhotoLibrary ) then media.selectVideo( { listener = onComplete ) end |
Similarly, you can present an interface to capture video using media.captureVideo():
1 2 3 4 5 6 7 8 9 10 |
local function onComplete(event) if event.completed then media.playVideo(event.url) end end if media.hasSource( media.Camera ) then media.captureVideo( { listener = onComplete } ) end |
We also created similar functions for photos: media.selectPhoto() and media.capturePhoto(). We recommend you use these instead of the deprecated “media.show()”:
Accessing/Playing the iTunes Library
With the new iTunes plugin, you’ll be able to access the iTunes library and play songs from them:
The “iTunes.show()” allows you to pick music from the iTunes library, which you can then play using “iTunes.play()”.
The full documentation is available here.
Maximilian
Posted at 08:09h, 28 OctoberNice! This will be very useful for certain apps and games!
Chris
Posted at 11:33h, 28 OctoberThis is *GREAT*!!!
Will you support accessing media files on Android, too, soon?
Thanks guys!!! Woohoo!
jen
Posted at 14:14h, 28 OctoberThis is ultrafab. Let the videotaping commence!!!