[TIMOB-24214] Android: VideoMaximumDuration and VideoQuality are not working using Android 6
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2018-07-27T17:38:53.000+0000 |
Affected Version/s | Release 6.0.0 |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Ricardo Ramirez |
Assignee | Lokesh Choudhary |
Created | 2016-12-12T22:40:28.000+0000 |
Updated | 2018-07-27T17:38:53.000+0000 |
Description
h2 Issue Description
Trying to increase the limit size and quality of videos it's capturing is not working using:
function showCamera_Android(e) {
Ti.Media.showCamera({
success : onMediaSuccess,
cancel : onMediaCancel,
error : onMediaError,
saveToPhotoGallery : true,
allowEditing : true,
videoMaximumDuration : 5000,
videoQuality : Ti.Media.QUALITY_MEDIUM,
mediaTypes : [Ti.Media.MEDIA_TYPE_VIDEO]
});
works on iOS and Android 5, but not using 6.
Creating Intents is also not working:
function showCamera_Android()
{
var intent = Titanium.Android.createIntent({ action: 'android.media.action.VIDEO_CAPTURE' });
/*
* THESE INTENTS ARE NOT WORKING
*
*/
intent.putExtra("android.provider.MediaStore.EXTRA_VIDEO_QUALITY",0);
intent.putExtra("android.provider.MediaStore.EXTRA_DURATION_LIMIT",3);
/*
* THESE INTENTS ARE NOT WORKING EITHER
*
*/
// intent.putExtra("android.intent.extra.durationLimit", 3);
// intent.putExtra("android.intent.extra.videoQuality", 0);
$.winMain.getActivity().startActivityForResult(intent, function(e) {
if (e.error)
{
}
else
{
if (e.resultCode === Titanium.Android.RESULT_OK) {
var videoUri = e.intent.data;
var source = Ti.Filesystem.getFile(videoUri);
var movieFile = Ti.Filesystem.getFile('appdata://sample.3gp');
if (movieFile.exists())
movieFile.deleteFile();
movieFile = Ti.Filesystem.getFile('appdata://sample.3gp');
source.copy(movieFile.nativePath);
videoBlob = movieFile;
var buffer = Ti.createBuffer({ value: "test"});
imgBlob = buffer.toBlob();
$.vidPlayer.url = videoUri;
$.vidPlayer.play();
}
}
});
}
Seems like a permission error. For 23+ API (Android 6), you need to explicitly ask for permissions for use of features. So for video recording it would be: In
AndroidManifest.xml
Please use that workaround for now while I fix this. :)
You need to add permissions in
tiapp.xml
#android #manifest tag. When the android app is generated, those will be inserted into #manifest tag inAndroidManifest.xml
. No permission will be granted on Android if it's not in the AndroidManifest.xml. After that the user needs to enable simply permissions. [~rramirez].The problem isn't with access to the camera, but in the maximum video duration and quality. My initial app permissions include:
[~rtrueman], you can limit video length by changing the videoMaximumDuration value which is uses ms as a measurement unit. I still could not reproduce error using Samsung Galaxy S6 and latest Titanium SDK version (master). Here is the app code:
Tried to reproduce the issue using both the attached app & the code by [~fmerzadyan] & what I see is the video does not auto stop recording after the
VideoMaximumDuration
is elapsed or restricts the recording to the given duration. Also, the for me theVideoQuality
always comes out to be the highest. Studio Ver: 4.9.0.201705180402 SDK Ver: 6.0.4.GA OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.2 Appc NPM: 4.2.9 Appc CLI: 6.2.1 Ti CLI Ver: 5.0.13 Alloy Ver: 1.9.11 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ oneplus A0001 --- Android 6.0.1