Search in sources :

Example 1 with MediaSourceSink

use of com.amazonaws.kinesisvideo.internal.client.mediasource.MediaSourceSink in project aws-sdk-android by aws-amplify.

the class AndroidCameraMediaSourceTest method testInitializedState.

@Test
public void testInitializedState() throws KinesisVideoException {
    cameraMediaSource = new AndroidCameraMediaSource(STREAM_NAME, context);
    cameraMediaSource.configure(configuration);
    MediaSourceSink sink = new MediaSourceSink() {

        @Override
        public void onFrame(@NonNull KinesisVideoFrame kinesisVideoFrame) throws KinesisVideoException {
        }

        @Override
        public void onCodecPrivateData(@Nullable byte[] codecPrivateData) throws KinesisVideoException {
        }

        @Override
        public void onCodecPrivateData(@Nullable byte[] codecPrivateData, int trackId) throws KinesisVideoException {
        }

        @Override
        public void onFragmentMetadata(@NonNull String metadataName, @NonNull String metadataValue, boolean persistent) throws KinesisVideoException {
        }

        @Override
        public KinesisVideoProducerStream getProducerStream() {
            return null;
        }
    };
    cameraMediaSource.initialize(sink);
    assertThat(cameraMediaSource.getMediaSourceState()).isEqualTo(MediaSourceState.INITIALIZED);
    assertThat(cameraMediaSource.getMediaSourceSink()).isEqualTo(sink);
    cameraMediaSource.free();
}
Also used : MediaSourceSink(com.amazonaws.kinesisvideo.internal.client.mediasource.MediaSourceSink) NonNull(androidx.annotation.NonNull) KinesisVideoFrame(com.amazonaws.kinesisvideo.producer.KinesisVideoFrame) Nullable(androidx.annotation.Nullable) Test(org.junit.Test)

Aggregations

NonNull (androidx.annotation.NonNull)1 Nullable (androidx.annotation.Nullable)1 MediaSourceSink (com.amazonaws.kinesisvideo.internal.client.mediasource.MediaSourceSink)1 KinesisVideoFrame (com.amazonaws.kinesisvideo.producer.KinesisVideoFrame)1 Test (org.junit.Test)1