I am using Android device for upload video on the server using titanium platform. I am facing following issue when retrieving data.
No Activity found to handle Intent { act=android.media.action.VIDEO_CAPTURE dat=content://com.example.videoupload.tifileprovider/filesystem/storage/emulated/0/Android/data/com.example.videoupload/cache/_tmp/tia7257530851591479880.mp4 typ=video/* flg=0x3 }
Following is the code which I am using:-
Titanium.Media.showCamera( {
success: function( event ) {
// called when media returned from the camera
if( ( event.mediaType === Ti.Media.MEDIA_TYPE_VIDEO ) && ( event.media !== null ) ) {
// AndroidSelectedImage(event.media.imageAsThumbnail(300));
var image = event.media;
var intent = Ti.Android.createIntent( {
action: "android.media.action.VIDEO_CAPTURE",
//action : Ti.Android.ACTION_PICK,
//flags : Titanium.Android.FLAG_GRANT_READ_URI_PERMISSION | Titanium.Android.FLAG_GRANT_WRITE_URI_PERMISSION,
//data : event.media.getFile().nativePath,
type: 'video/*',
} );
var activity = require( 'main' ).activity;
//winCertificate.getActivity()
activity.startActivityForResult( intent, function( param ) {
Ti.API.info( 'intent :- ' + JSON.stringify( intent ) );
Ti.API.info( 'intent 1:- ' + JSON.stringify( param ) );
} );
} );
} );
Help me in this situation. Thanks in advance
Send you video directly to the server using HttpClient
success: function( event ) {
if( ( event.mediaType === Ti.Media.MEDIA_TYPE_VIDEO ) && ( event.media !== null ) ) {
var client = Ti.Network.createHTTPClient( {
onload: function( e ) {
alert( 'success' );
},
onerror: function( e ) {
alert( 'error' );
},
timeout: 0
} );
client.open( "GET", URL );
client.send( {
video: media.video
} );
}
}
With titanium activity start like this
Ti.Android.currentActivity.startActivity(intent);