Skip to content

Instantly share code, notes, and snippets.

@marchbold
Created September 8, 2016 06:42
Show Gist options
  • Save marchbold/c9f9e4eb01f552d933a1a5632ee7af89 to your computer and use it in GitHub Desktop.
Save marchbold/c9f9e4eb01f552d933a1a5632ee7af89 to your computer and use it in GitHub Desktop.
Capture a Video using the Camera UI
CameraUI.service.addEventListener( CameraUIEvent.COMPLETE, cameraUI_completeHandler );
CameraUI.service.addEventListener( CameraUIEvent.CANCEL, cameraUI_cancelHandler );
var options:CameraUIOptions = new CameraUIOptions();
options.videoQuality = QualityType.TYPE_HIGH;
CameraUI.service.launch( MediaType.VIDEO, options );
...
private function cameraUI_completeHandler( event:CameraUIEvent ):void
{
// Here you can use the event.path to access the media file as you require
// For example using the distriqt MediaPlayer:
MediaPlayer.service.createPlayer( event.path, 0, 0, 640, 480, true );
MediaPlayer.service.addEventListener( MediaPlayerEvent.COMPLETE, function(e:MediaPlayerEvent):void {
MediaPlayer.service.removeEventListener( MediaPlayerEvent.COMPLETE, arguments.callee );
MediaPlayer.service.removePlayer();
});
}
private function cameraUI_cancelHandler( event:CameraUIEvent ):void
{
trace( "user cancel" );
}
// com.distriqt.CameraUI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment