Search in sources :

Example 1 with KinesisVideoClient

use of com.amazonaws.kinesisvideo.client.KinesisVideoClient in project aws-sdk-android by aws-amplify.

the class KinesisVideoAndroidClientFactory method createKinesisVideoClient.

/**
 * Create KinesisVideo client.
 */
public static KinesisVideoClient createKinesisVideoClient(@NonNull final Context context, @NonNull final KinesisVideoClientConfiguration configuration, @NonNull final DeviceInfo deviceInfo, @NonNull final Log log, @NonNull final ScheduledExecutorService executor) throws KinesisVideoException {
    if (KINESIS_VIDEO_CLIENT_INSTANCE == null) {
        final KinesisVideoAndroidServiceClient serviceClient = new KinesisVideoAndroidServiceClient(log);
        final KinesisVideoClient kinesisVideoClient = new AndroidKinesisVideoClient(log, context, configuration, serviceClient, executor);
        kinesisVideoClient.initialize(deviceInfo);
        KINESIS_VIDEO_CLIENT_INSTANCE = kinesisVideoClient;
    }
    return KINESIS_VIDEO_CLIENT_INSTANCE;
}
Also used : KinesisVideoAndroidServiceClient(com.amazonaws.mobileconnectors.kinesisvideo.service.KinesisVideoAndroidServiceClient) KinesisVideoClient(com.amazonaws.kinesisvideo.client.KinesisVideoClient)

Example 2 with KinesisVideoClient

use of com.amazonaws.kinesisvideo.client.KinesisVideoClient 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

KinesisVideoClient (com.amazonaws.kinesisvideo.client.KinesisVideoClient)2 CameraMediaSourceConfiguration (com.amazonaws.kinesisvideo.client.mediasource.CameraMediaSourceConfiguration)1 KinesisVideoException (com.amazonaws.kinesisvideo.common.exception.KinesisVideoException)1 KinesisVideoAndroidServiceClient (com.amazonaws.mobileconnectors.kinesisvideo.service.KinesisVideoAndroidServiceClient)1