Search in sources :

Example 16 with KinesisVideoException

use of com.amazonaws.kinesisvideo.common.exception.KinesisVideoException in project amazon-kinesis-video-streams-parser-library by aws.

the class H264FrameProcessor method initializeKinesisVideoProducer.

private void initializeKinesisVideoProducer(final int width, final int height, final byte[] cpd) {
    try {
        log.info("Initializing KVS Producer with stream name {} and region : {}", outputKvsStreamName, regionName);
        final KinesisVideoClient kinesisVideoClient = KinesisVideoJavaClientFactory.createKinesisVideoClient(regionName, credentialsProvider);
        final CameraMediaSourceConfiguration configuration = new CameraMediaSourceConfiguration.Builder().withFrameRate(30).withRetentionPeriodInHours(1).withCameraId("/dev/video0").withIsEncoderHardwareAccelerated(false).withEncodingMimeType("video/avc").withNalAdaptationFlags(StreamInfo.NalAdaptationFlags.NAL_ADAPTATION_ANNEXB_NALS).withIsAbsoluteTimecode(true).withEncodingBitRate(200000).withHorizontalResolution(width).withVerticalResolution(height).withCodecPrivateData(cpd).build();
        this.KVSMediaSource = new KVSMediaSource(ProducerStreamUtil.toStreamInfo(outputKvsStreamName, configuration));
        this.KVSMediaSource.configure(configuration);
        // register media source with Kinesis Video Client
        kinesisVideoClient.registerMediaSource(KVSMediaSource);
    } catch (final KinesisVideoException e) {
        log.error("Exception while initialize KVS Producer !", e);
    }
}
Also used : CameraMediaSourceConfiguration(com.amazonaws.kinesisvideo.client.mediasource.CameraMediaSourceConfiguration) KinesisVideoClient(com.amazonaws.kinesisvideo.client.KinesisVideoClient) KinesisVideoException(com.amazonaws.kinesisvideo.common.exception.KinesisVideoException)

Aggregations

KinesisVideoException (com.amazonaws.kinesisvideo.common.exception.KinesisVideoException)16 KinesisVideoCredentialsProvider (com.amazonaws.kinesisvideo.auth.KinesisVideoCredentialsProvider)6 ProducerException (com.amazonaws.kinesisvideo.producer.ProducerException)6 AmazonClientException (com.amazonaws.AmazonClientException)5 AWSKinesisVideoClient (com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient)5 KinesisVideoCredentials (com.amazonaws.kinesisvideo.auth.KinesisVideoCredentials)2 StreamDescription (com.amazonaws.kinesisvideo.producer.StreamDescription)2 CameraAccessException (android.hardware.camera2.CameraAccessException)1 CameraDevice (android.hardware.camera2.CameraDevice)1 CameraManager (android.hardware.camera2.CameraManager)1 Handler (android.os.Handler)1 AWSCredentials (com.amazonaws.auth.AWSCredentials)1 AWSSessionCredentials (com.amazonaws.auth.AWSSessionCredentials)1 CognitoCredentialsProvider (com.amazonaws.auth.CognitoCredentialsProvider)1 KinesisVideoClient (com.amazonaws.kinesisvideo.client.KinesisVideoClient)1 CameraMediaSourceConfiguration (com.amazonaws.kinesisvideo.client.mediasource.CameraMediaSourceConfiguration)1 OnStreamDataAvailable (com.amazonaws.kinesisvideo.internal.mediasource.OnStreamDataAvailable)1 KinesisVideoFrame (com.amazonaws.kinesisvideo.producer.KinesisVideoFrame)1 Tag (com.amazonaws.kinesisvideo.producer.Tag)1 AWSMobileClient (com.amazonaws.mobile.client.AWSMobileClient)1