Search in sources :

Example 1 with AudioTrack

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());
}
Also used : AudioTrack(android.media.videoeditor.AudioTrack) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 2 with AudioTrack

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();
}
Also used : AudioTrack(android.media.videoeditor.AudioTrack) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 3 with AudioTrack

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);
}
Also used : MediaVideoItem(android.media.videoeditor.MediaVideoItem) MediaImageItem(android.media.videoeditor.MediaImageItem) AudioTrack(android.media.videoeditor.AudioTrack) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 4 with AudioTrack

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));
}
Also used : MediaVideoItem(android.media.videoeditor.MediaVideoItem) AudioTrack(android.media.videoeditor.AudioTrack) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 5 with AudioTrack

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);
}
Also used : AudioTrack(android.media.videoeditor.AudioTrack) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Aggregations

AudioTrack (android.media.videoeditor.AudioTrack)26 LargeTest (android.test.suitebuilder.annotation.LargeTest)25 MediaVideoItem (android.media.videoeditor.MediaVideoItem)12 MediaImageItem (android.media.videoeditor.MediaImageItem)10 TransitionCrossfade (android.media.videoeditor.TransitionCrossfade)5 MediaProcessingProgressListener (android.media.videoeditor.VideoEditor.MediaProcessingProgressListener)5 Bitmap (android.graphics.Bitmap)2 Rect (android.graphics.Rect)2 EffectColor (android.media.videoeditor.EffectColor)2 EffectKenBurns (android.media.videoeditor.EffectKenBurns)2 MediaItem (android.media.videoeditor.MediaItem)2 OverlayFrame (android.media.videoeditor.OverlayFrame)2 VideoEditor (android.media.videoeditor.VideoEditor)2 ExportProgressListener (android.media.videoeditor.VideoEditor.ExportProgressListener)2 ExtractAudioWaveformProgressListener (android.media.videoeditor.ExtractAudioWaveformProgressListener)1 Transition (android.media.videoeditor.Transition)1 TransitionAlpha (android.media.videoeditor.TransitionAlpha)1 TransitionFadeBlack (android.media.videoeditor.TransitionFadeBlack)1 TransitionSliding (android.media.videoeditor.TransitionSliding)1 OverlayData (android.media.videoeditor.VideoEditor.OverlayData)1