use of android.media.videoeditor.AudioTrack in project android_frameworks_base by ParanoidAndroid.
the class VideoEditorAPITest method testAudioTrackLooping.
/**
* To Test the Audio Track API: Looping
*/
@LargeTest
public void testAudioTrackLooping() throws Exception {
final String audioFileName = INPUT_FILE_PATH + "AACLC_48KHz_256Kbps_s_1_17.3gp";
final AudioTrack audioTrack = mVideoEditorHelper.createAudio(mVideoEditor, "audioTrack", audioFileName);
mVideoEditor.addAudioTrack(audioTrack);
assertFalse("Audio Looping", audioTrack.isLooping());
audioTrack.enableLoop();
assertTrue("Audio Looping", audioTrack.isLooping());
audioTrack.disableLoop();
assertFalse("Audio Looping", audioTrack.isLooping());
}
use of android.media.videoeditor.AudioTrack in project android_frameworks_base by ParanoidAndroid.
the class VideoEditorAPITest method testAudioTrack.
/**
* To test creation of Audio Track
*/
@LargeTest
public void testAudioTrack() throws Exception {
final String audioFileName = INPUT_FILE_PATH + "AACLC_48KHz_256Kbps_s_1_17.3gp";
final AudioTrack audioTrack = mVideoEditorHelper.createAudio(mVideoEditor, "audioTrack", audioFileName);
mVideoEditor.addAudioTrack(audioTrack);
assertEquals("Audio Track Item Duration", audioTrack.getDuration(), audioTrack.getTimelineDuration());
assertEquals("Audio Track Start Time", 0, audioTrack.getStartTime());
assertFalse("Audio Track is Looping", audioTrack.isLooping());
audioTrack.getVolume();
assertFalse("Audio Track Ducking is Disabled", audioTrack.isDuckingEnabled());
assertTrue("Audio Track Filename", audioTrack.getFilename().equals(audioFileName));
assertEquals("Audio Ducking Threshold", 0, audioTrack.getDuckingThreshhold());
assertFalse("Audio Track Mute", audioTrack.isMuted());
audioTrack.getDuckedTrackVolume();
}
use of android.media.videoeditor.AudioTrack in project android_frameworks_base by ParanoidAndroid.
the class VideoEditorAPITest method testNullAPIs.
/**
* To test: NULL arguments to the Video Editor APIs
*
* @throws Exception
*/
@LargeTest
public void testNullAPIs() throws Exception {
final String videoItemFilename1 = INPUT_FILE_PATH + "H264_BP_640x480_30fps_256kbps_1_17.mp4";
final String maskFilename = INPUT_FILE_PATH + "IMG_640x480_Overlay1.png";
final String audioFileName = INPUT_FILE_PATH + "AACLC_48KHz_256Kbps_s_1_17.3gp";
boolean flagForException = false;
try {
mVideoEditor.addAudioTrack(null);
} catch (IllegalArgumentException e) {
flagForException = true;
}
assertTrue("Video Editor with null Audio Track", flagForException);
flagForException = false;
try {
mVideoEditor.addMediaItem(null);
} catch (IllegalArgumentException e) {
flagForException = true;
}
assertTrue("Video Editor with NULL Image Item ", flagForException);
flagForException = false;
try {
mVideoEditor.addMediaItem(null);
} catch (IllegalArgumentException e) {
flagForException = true;
}
assertTrue("Video Editor with NULL Video Item ", flagForException);
MediaVideoItem mediaVideoItem1 = null;
try {
mediaVideoItem1 = mVideoEditorHelper.createMediaItem(mVideoEditor, "m1", videoItemFilename1, MediaItem.RENDERING_MODE_BLACK_BORDER);
} catch (IllegalArgumentException e) {
assertTrue("Cannot Create Video Item", false);
}
mediaVideoItem1.setExtractBoundaries(0, 15000);
mVideoEditor.addMediaItem(mediaVideoItem1);
flagForException = false;
try {
mediaVideoItem1.addEffect(null);
} catch (IllegalArgumentException e) {
flagForException = true;
}
assertTrue("Video with null effect ", flagForException);
flagForException = false;
try {
mediaVideoItem1.addOverlay(null);
} catch (IllegalArgumentException e) {
flagForException = true;
}
assertTrue("Video with null overlay ", flagForException);
final MediaImageItem mediaImageItem = mVideoEditorHelper.createMediaItem(mVideoEditor, "m2", maskFilename, 10000, MediaItem.RENDERING_MODE_BLACK_BORDER);
mediaImageItem.setDuration(15000);
mVideoEditor.addMediaItem(mediaImageItem);
flagForException = false;
try {
mediaImageItem.addEffect(null);
} catch (IllegalArgumentException e) {
flagForException = true;
}
assertTrue("Image with null effect ", flagForException);
flagForException = false;
try {
mediaImageItem.addOverlay(null);
} catch (IllegalArgumentException e) {
flagForException = true;
}
assertTrue("Image with null overlay ", flagForException);
final AudioTrack audioTrack = mVideoEditorHelper.createAudio(mVideoEditor, "audioTrack", audioFileName);
mVideoEditor.addAudioTrack(audioTrack);
flagForException = false;
try {
mVideoEditor.addTransition(null);
} catch (IllegalArgumentException e) {
flagForException = true;
}
assertTrue("Added null transition ", flagForException);
flagForException = false;
try {
mVideoEditor.addTransition(null);
} catch (IllegalArgumentException e) {
flagForException = true;
}
assertTrue("Added null transition ", flagForException);
}
use of android.media.videoeditor.AudioTrack in project android_frameworks_base by ParanoidAndroid.
the class VideoEditorAPITest method testVideoLessThanAudio.
/**
* To add Audio Track Greater than MediaItem Duration
*
* @throws Exception
*/
@LargeTest
public void testVideoLessThanAudio() throws Exception {
final String videoItemFileName1 = INPUT_FILE_PATH + "MPEG4_SP_720x480_30fps_280kbps_AACLC_48kHz_96kbps_s_0_21.mp4";
final String audioTrackFilename = INPUT_FILE_PATH + "AACLC_48KHz_256Kbps_s_1_17.3gp";
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
final MediaVideoItem mediaVideoItem1 = mVideoEditorHelper.createMediaItem(mVideoEditor, "m1", videoItemFileName1, renderingMode);
mVideoEditor.addMediaItem(mediaVideoItem1);
final AudioTrack audioTrack = mVideoEditorHelper.createAudio(mVideoEditor, "audioTrackId", audioTrackFilename);
mVideoEditor.addAudioTrack(audioTrack);
assertEquals("Storyboard = mediaItem Duration", mediaVideoItem1.getDuration(), mVideoEditor.getDuration());
assertTrue("Audio Duration > mediaItem Duration", (audioTrack.getDuration() > mediaVideoItem1.getDuration() ? true : false));
}
use of android.media.videoeditor.AudioTrack in project android_frameworks_base by ParanoidAndroid.
the class VideoEditorAPITest method testRemoveAudioTrack.
/**
* To test: Remove audio track
*
* @throws Exception
*/
@LargeTest
public void testRemoveAudioTrack() throws Exception {
final String audioFileName = INPUT_FILE_PATH + "AACLC_48KHz_256Kbps_s_1_17.3gp";
boolean flagForException = false;
final AudioTrack audioTrack = mVideoEditorHelper.createAudio(mVideoEditor, "audioTrack1", audioFileName);
mVideoEditor.addAudioTrack(audioTrack);
assertEquals("Audio Track Item Duration", audioTrack.getDuration(), audioTrack.getTimelineDuration());
assertTrue("Audio Track ID", audioTrack.getId().equals("audioTrack1"));
assertNotNull("Remove Audio Track", mVideoEditor.removeAudioTrack("audioTrack1"));
try {
mVideoEditor.removeAudioTrack("audioTrack1");
} catch (IllegalArgumentException e) {
flagForException = true;
}
assertTrue("Remove Audio Track not possible", flagForException);
}
Aggregations