I want to stream from my webcam to Kinesis Video Streams. I have been reading the documentation and following the AWS tutorials. After starting the DemoAppMain with the command:
java -classpath target/amazon-kinesis-video-streams-producer-sdk-java-1.11.0-jar-with-dependencies.jar "-Daws.accessKeyId=fake_accessKeyID -Daws.secretKey=fake_secretKey -Dkvs-stream=fake_streamName -Djava.library.path=src\main\resources\lib\windows\KinesisVideoProducerJNI.dll" com.amazonaws.kinesisvideo.demoapp.DemoAppMain
I obtain the following exceptions:
DEBUG / KinesisVideo: Unsatisfied link error. Directly loading native library .so.
DEBUG / KinesisVideo: Unsatisfied link error. Directly loading native library .dylib.
DEBUG / KinesisVideo: Unsatisfied link error. Directly loading native library .dll.
DEBUG / KinesisVideo: Unsatisfied link error. Directly loading native library libKinesisVideoProducerJNI.so.
DEBUG / KinesisVideo: Unsatisfied link error. Directly loading native library libKinesisVideoProducerJNI.dylib.
DEBUG / KinesisVideo: Unsatisfied link error. Directly loading native library libKinesisVideoProducerJNI.dll.
ERROR / KinesisVideo: 2021-10-18T10:50Z T1: EXCEPTION: UnsatisfiedLinkError: Unsatisfied link error. Loading native library KinesisVideoProducerJNI failed with java.lang.UnsatisfiedLinkError: no KinesisVideoProducerJNI in java.library.path: ...
Exception in thread "main" java.lang.RuntimeException: com.amazonaws.kinesisvideo.producer.ProducerException: Failed loading native library StatusCode: 0xd
at com.amazonaws.kinesisvideo.demoapp.DemoAppMain.main(DemoAppMain.java:60)
Caused by: com.amazonaws.kinesisvideo.producer.ProducerException: Failed loading native library StatusCode: 0xd
at com.amazonaws.kinesisvideo.internal.producer.jni.NativeKinesisVideoProducerJni.initializeLibrary(NativeKinesisVideoProducerJni.java:1177)
at com.amazonaws.kinesisvideo.internal.producer.jni.NativeKinesisVideoProducerJni.create(NativeKinesisVideoProducerJni.java:229)
at com.amazonaws.kinesisvideo.internal.producer.jni.NativeKinesisVideoProducerJni.createSync(NativeKinesisVideoProducerJni.java:247)
at com.amazonaws.kinesisvideo.internal.producer.jni.NativeKinesisVideoProducerJni.createSync(NativeKinesisVideoProducerJni.java:212)
at com.amazonaws.kinesisvideo.internal.client.NativeKinesisVideoClient.initializeNewKinesisVideoProducer(NativeKinesisVideoClient.java:238)
at com.amazonaws.kinesisvideo.internal.client.NativeKinesisVideoClient.initialize(NativeKinesisVideoClient.java:119)
at com.amazonaws.kinesisvideo.java.client.KinesisVideoJavaClientFactory.createKinesisVideoClient(KinesisVideoJavaClientFactory.java:113)
at com.amazonaws.kinesisvideo.java.client.KinesisVideoJavaClientFactory.createKinesisVideoClient(KinesisVideoJavaClientFactory.java:86)
at com.amazonaws.kinesisvideo.demoapp.DemoAppMain.main(DemoAppMain.java:42)
I did research on the internet but without success. That's the reason why I make this post. If anyone knows how to solve the problem, I would be very grateful!
The error states:
no KinesisVideoProducerJNI in java.library.path
How did you add this lib into your class path exactly?
The documentation states the prerequisites to have this library:
Your NativeLibraryPath must contain your KinesisVideoProducerJNI file, available at https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp
. The file name extension for this file depends on your operating system:
KinesisVideoProducerJNI.so for Linux
KinesisVideoProducerJNI.dylib for macOS
KinesisVideoProducerJNI.dll for Windows
If you look at the windows folder, this library exists there:
Perhaps doing this would work:
-Djava.library.path=src/main/resources/lib/windows <-- The Directory!
java -classpath target/amazon-kinesis-video-streams-producer-sdk-java-1.11.0-jar-with-dependencies.jar -Daws.accessKeyId=<ACCESS_KEY> -Daws.secretKey=<SECRET_KEY> -Dkvs-stream=<KINESIS_VIDEO_STREAM_NAME> -Djava.library.path=src/main/resources/lib/windows com.amazonaws.kinesisvideo.demoapp.DemoAppMain