VideoRoll is a native extension for accessing saved videos. Using this extension it’s possible to display the video roll dialog and read information related to the video that has been selected by the user. The extension provides methods to read the video as a ByteArray
stream, check its length, generate a thumbnail of any frame or the video itself (as BitmapData
) and much more.
The extension can return a URL to a selected video location, set a custom label on the video roll screen, use the native iOS video trimmer, set a max length on a video and create multiple thumbnails from an array of times.
Sample
protected function showVideoRoll():void { var videoRoll:VideoRoll = VideoRoll.instance; // Acquire an instance videoRoll.addEventListener(VideoRollEvent.ON_VIDEO_SELECT, handleVideoSelect); // Dispatched on video select videoRoll.openVideoRoll(); // Open the video roll } private function handleVideoSelect(e:VideoRollEvent):void { // this will not return a thumbnail or video ByteArray e.videoUrl //Video URL e.videoLength //Video Length var f:File = new File(e.videoUrl); // The location is returned in the event var ba:ByteArray = new ByteArray(); // Create a ByteArray to load the video into var fs:FileStream = new FileStream(); fs.open(f, FileMode.READ); fs.readBytes(ba, 0, fs.bytesAvailable); // Read the video into the BA fs.close(); }
RT @as3gamegears: New: VideoRoll (native extension for accessing saved videos on iOS) http://t.co/2RKoh3ex0f #as3 #flash #gamedev