AndroidMediaSDK Java Documentation
AndroidMediaSDK
AndroidMediaSDK gives access to Leia AI/ML and advanced VR functionality.
- Support for Multiview images (LIF/MPO/JPS)
- Optimizing Multiview images for viewing on multi-view devices
a. Calculating and changing 3d focus (convergence) plane
b. Calculating and changing 3d depth (gain)
c. Re-synthesizing image for device (2v to 4v or 2v to 16v for example)
d. Calculating depth/disparity maps for each view
- Playback support for SBS video with dynamic 3d focus (convergence)
- Playback support for regular mono video with real-time conversion to 3d
Usage
All examples below are using Leia CNSDK to properly show content on the device.
Detailed examples could be found in this repo https://github.com/LeiaInc/AndroidMediaSdk-examples
Loading LIF/MPO/JPS as MultiviewImage
```
MultiviewImageDecoder decoder = MultiviewImageDecoder.getDefault();
MultiviewImage decoder.decode(context, Uri.fromFile(new File(mFilename)));
```
Showing MultiviewImage on screen
```
MultiviewSynthesizer2 mSynthesizer = LeiaMediaSDK.getInstance(this)
.createMultiviewSynthesizer(this, true, true, true, true);
MultiviewImage imageWithSynthesizedViews = mSynthesizer.synthesizeViews(imageWithDisparity, 2); //LP2 shows 2 views at the same time
// CNSK specific, show image on screen, please refer to CNSDK documentation on how to init asset,interlacedSurfaceView
asset = InputViewsAsset.createSurfaceFromLoadedBitmap(mSynthesizer.toTiledBitmap(
result.mRichImageWithSynthesizedViews), true);
interlacedSurfaceView.setViewAsset(asset);
```
Playback Mono content with live conversion to 3d using Exoplayer
```
private void configure(SurfaceTexture surfaceTexture) {
mMonoVideoSurfaceRenderer =
LeiaMediaSDK.getInstance(this)
.createMonoVideoSurfaceRenderer(
this,
new Surface(surfaceTexture),
monoSurfaceTexture -> configureExoplayer(surfaceTexture, monoSurfaceTexture));
}
InputViewsAsset asset = InputViewsAsset.CreateEmptySurfaceForVideo(
screenWidth,
screenHeight,
surfaceTexture -> {
surfaceTexture.setDefaultBufferSize(screenWidth, screenHeight);
configure(surfaceTexture);
});
interlacedSurfaceView.setViewAsset(asset);
```
Build basics
For Android app to be able to use AndroidMediaSDK it needs certian libraries and settings
Libraries:
- leiamediasdk >= 0.5.15
- androidsdk-photoformat >=5.3.9 (if LIF/MPO/JPS support is required)
- sdk-faceTrackingService >=0.7.9
Settings:
AndroidManifest
```
android:extractNativeLibs="true"
```
build.gradle
1.
```
targetSdkVersion <= 30
```
2.
```android {
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
doNotStrip "*/armeabi-v7a/libsnpe_*.so"
doNotStrip "*/arm64-v8a/libsnpe_*.so"
}
```