🌐 https://insta360develop.github.io/Insta360-Developer_Docs/
⚠️ If the above Pages site fails to load (access to github.io is unstable on some networks), you may directly browse the Markdown documents at the link below: https://github.com/Insta360Develop/Insta360-Developer_Docs
⚠️ This repository will no longer be maintained moving forward; all subsequent content will be migrated to the aforementioned Online Documentation.
Currently on V1.9.4 branch. To view other versions, please switch branches.
32-bit library (armeabi-v7a) is no longer maintained, please use 64-bit library (arm64-v8a) to build!
Please visit https://www.insta360.com/sdk/apply to apply for the latest SDK.
Developers' Page: https://www.insta360.com/developer/home
Insta360 Enterprise: https://www.insta360.com/enterprise
Issue Report: https://insta.jinshuju.com/f/hZ4aMW
The Android SDK is mainly used for connecting, setting and obtaining camera parameters, controlling the camera for taking photos and recording, downloading files, firmware upgrades, and supporting video and image exports.
Supported models: X5, X4, X3, ONE X2, ONE X, ONE RS, ONE RS 1-Inch.
Add the Maven repository to the build file (the build.gradle file in the project root):
allprojects {
repositories {
...
maven {
url 'x.x.x'// see sdk demo
credentials {
// see sdk demo
username ='***'
password ='***'
} }
}
}- Import the dependency library in the
build.gradlefile located in the Demo directory:
dependencies {
implementation 'com.arashivision.sdk:sdkcamera:x.x.x'// see sdk demo
}- Initialize the SDK in the application
publicclassMyAppextendsApplication {
@OverridepublicvoidonCreate() {
super.onCreate(); InstaCameraSDK.init(this);
}
}You can determine if the camera is connected by obtaining the current camera connection type.
privatebooleanisCameraConnected() {
inttype = InstaCameraManager.getInstance().getCameraConnectedType();
returntype != InstaCameraManager.CONNECT_TYPE_NONE;
}The connection types have the following four outcomes:
- Not connected:
InstaCameraManager.CONNECT_TYPE_NONE - USB connection:
InstaCameraManager.CONNECT_TYPE_USB - Wi-Fi connection:
InstaCameraManager.CONNECT_TYPE_WIFI - Bluetooth connection:
InstaCameraManager.CONNECT_TYPE_BLE
You can connect to the camera via Bluetooth, Wi-Fi, or USB
Note: You must perform the connection operation on the main thread.
Note: When the camera is connected, if the app switches to the background, it will disconnect due to the characteristics of the Android system. Therefore, it is necessary to enable a foreground service to prevent disconnection from the camera. This foreground server is implemented by the developer themselves. The relevant code can refer to the SDK Demo.
Note: Bluetooth connection requires successful authorization of Bluetooth-related permissions.
Note: In the case of a Bluetooth connection, large data transmission is not supported. Therefore, functions that transmit large amounts of data are not supported.
For example: live streaming, preview, support list, firmware upgrade, playback, export, etc.
- Initialize Bluetooth Scanning
InstaCameraManager.getInstance().startBleScan();- Set the Bluetooth Scanning Listener
InstaCameraManager.getInstance().setScanBleListener(newIScanBleListener() {
@OverridepublicvoidonScanStartSuccess() {
//Bluetooth is about to start scanning
}
@OverridepublicvoidonScanStartFail() {
//Bluetooth scanning failed
}
@OverridepublicvoidonScanning(BleDevicebleDevice) {
//A new Bluetooth device has been scanned; you can update the Bluetooth device list here
}
@OverridepublicvoidonScanFinish(List<BleDevice> bleDeviceList) {
//Bluetooth scanning finished
}
});- Stopping Bluetooth Scanning
InstaCameraManager.getInstance().stopBleScan();- Checking if Bluetooth is Scanning
InstaCameraManager.getInstance().isBleScanning();- Establishing a Bluetooth Connection with the Camera
InstaCameraManager.getInstance().connectBle(bleDevice);Note: Ensure that the phone is already connected to the camera’s Wi-Fi.The Wi-Fi password of the camera can be viewed in the settings menu of the camera, or by connecting via Bluetooth and calling to read the Wi-Fi information (SSID and password) of the camera.
InstaCameraManager.getInstance().openCamera(InstaCameraManager.CONNECT_TYPE_WIFI);Note: Ensure that the phone and camera have established a USB connection, and the camera must be switched to Android mode.
InstaCameraManager.getInstance().openCamera(InstaCameraManager.CONNECT_TYPE_USB);When you want to disconnect the camera, you can call the following code.
InstaCameraManager.getInstance().closeCamera();When connected to Bluetooth, the camera's Wi-Fi can be turned on and off using the following code.
ICameraOperateCallbackcallback = newICameraOperateCallback() {
@OverridepublicvoidonSuccessful() {
// The command was executed successfully
}
@OverridepublicvoidonFailed() {
// Command execution failed
}
@OverridepublicvoidonCameraConnectError() {
// The camera is disconnected or not connected
}
};
// Turn on the camera's wifi and use the camera's default channelInstaCameraManager.getInstance().openCameraWifi(callback);
// Open the camera wifi on the specified channelInstaCameraManager.getInstance().openCameraWifi(intcountryChannel ,callback);
// Turn off camera wifiInstaCameraManager.getInstance().closeCameraWifi(callback)
// Restart the camera Wi-Fi, including two operations: turn off and turn on, use the camera's default channel to turn onInstaCameraManager.getInstance().resetCameraWifi(callback)
// Restart the camera Wi-Fi by specifying a channelInstaCameraManager.getInstance().resetCameraWifi(intcountryChannelcallback)// Get camera Wi-Fi informationWifiInfowifiInfo = InstaCameraManager.getInstance().getWifiInfo();
// Wi-Fi nameStringssid = wifiInfo.getSsid();
// Wi-Fi passwordStringssid = wifiInfo.getPwd();
// Password versionintpwdVersion= wifiInfo.getPwdVersion();
// Wi-Fi channelintchannel= wifiInfo.getChannel();
// mac addressStringaddress = wifiInfo.getMacAddress();
// Get the Wi-Fi country codeStrincountry = InstaCameraManager.getInstance().getWifiCountry();// Get current country code and Wi-Fi channelInstaCameraManager.getInstance().fetchWifiChannel((countryCode, cameraChannel) -> {
// Get country code and current Wi-Fi channel
});
// Set Wi-Fi country codeInstaCameraManager.getInstance().setWifiCountry("CN", newICameraOperateCallback() {
@OverridepublicvoidonSuccessful() {
// Setup successful
}
@OverridepublicvoidonFailed() {
// Setup failed
}
@OverridepublicvoidonCameraConnectError() {
// Camera connection error
}
});
// Get Wi-Fi channel listint[] channelList = InstaCameraManager.getInstance().getWifiChannelList();Synchronizing camera parameters means reading all the internal camera parameters at once and caching them in the application. Call the following code to synchronize all camera parameters (Synchronization of all parameters and status).
InstaCameraManager.getInstance().fetchCameraOptions(newICameraOperateCallback() {
@OverridepublicvoidonSuccessful() {
// Camera parameters synchronized successfully
}
@OverridepublicvoidonFailed() {
// Camera parameter synchronization failed
}
@OverridepublicvoidonCameraConnectError() {
// Camera connection failed, which may indicate a camera disconnection event
}
});For X4 and later cameras, the capturing mode and capturing properties of the camera are based on the properties configured in the support list. Different cameras support different capturing modes, and there are also differences in the capturing properties supported under different capturing modes. Before capturing, synchronize the camera's supported list (Json file).
When entering the prep page or switching lenses, the support list needs to be initialized. This can be achieved by calling the following code:
InstaCameraManager.getInstance().initCameraSupportConfig(success -> {
// success: Whether initialization was successful
});Each lens of the camera supports different capturing modes. You need to use the following code to obtain its supported capturing modes.
// Get all supported capturing modesList<CaptureMode> support = InstaCameraManager.getInstance().getSupportCaptureMode();Each capturing mode supports different capturing attributes. You need to use the following code to obtain the supported capturing attributes.
// Pass in the specified capturing mode as parametersList<CaptureSetting> support = InstaCameraManager.getInstance().getSupportCaptureSettingList(CaptureMode.CAPTURE_NORMAL);The value range of the capturing attribute is also configured in the support list. You need to use the following code to obtain the value range of the supported capturing attribute.
// Gets the property value range of CaptureSetting.RECORD_DURATION, returns a List < RecordDuration >InstaCameraManager.getInstance().getSupportRecordDurationList(CaptureMode.TIMELAPSE);
// Get the value range of the property value of CaptureSetting.RECORD_RESOLUTION and return a List < RecordResolution >InstaCameraManager.getInstance().getSupportRecordResolutionList(CaptureMode.TIMELAPSE);
// Get the value range of the property value of CaptureSetting.PHOTO_RESOLUTION and return a List < PhotoResolution >InstaCameraManager.getInstance().getSupportPhotoResolutionList(CaptureMode.CAPTURE_NORMAL);
// Get the range of property values of CaptureSetting. INTERVAL and return a List < Interval > listInstaCameraManager.getInstance().getSupportIntervalList(CaptureMode.TIMELAPSE);
// Get the value range of the property value of CaptureSetting.HDR_STATUS and return a List < HdrStatus >InstaCameraManager.getInstance().getSupportHdrStatusList(CaptureMode.TIMELAPSE);
// Get the value range of the property value of CaptureSetting.PHOTO_HDR_TYPE and return a List < PhotoHdrType >InstaCameraManager.getInstance().getSupportPhotoHdrTypeList(CaptureMode.CAPTURE_NORMAL);
// Get the value range of the property value of CaptureSetting.GAMMA_MODE and return a List < GammaMode >InstaCameraManager.getInstance().getSupportGammaModeList(CaptureMode.TIMELAPSE);
// Get the value range of the property value of CaptureSetting.RAW_TYPE and return a List < RawType >InstaCameraManager.getInstance().getSupportRawTypeList(CaptureMode.TIMELAPSE);
// Get the value range of the property value of CaptureSetting.PANO_EXPOSURE_MODE and return a List < PanoExposureMode >InstaCameraManager.getInstance().getSupportPanoExposureList(CaptureMode.TIMELAPSE);
// Get the property value range of CaptureSetting. EXPOSURE and return a List < Exposure >InstaCameraManager.getInstance().getSupportExposureList(CaptureMode.TIMELAPSE);
// Get the value range of the CaptureSetting. ISO property and return a List < ISO >InstaCameraManager.getInstance().getSupportISOList(CaptureMode.TIMELAPSE);
// Gets the value range of the CaptureSetting.ISO_TOP_LIMIT property and returns a List < ISOTopLimit >InstaCameraManager.getInstance().getSupportISOTopLimitList(CaptureMode.TIMELAPSE);
// Gets the value range of the CaptureSetting.SHUTTER_MODE property and returns a List < ShutterMode >InstaCameraManager.getInstance().getSupportShutterModeList(CaptureMode.TIMELAPSE);
// Get the value range of the property value of CaptureSetting. SHUTTER and return a List < Shutter >InstaCameraManager.getInstance().getSupportShutterList(CaptureMode.TIMELAPSE);
// Get the value range of the attribute value of CaptureSetting. EV and return a List < Ev >InstaCameraManager.getInstance().getSupportEVList(CaptureMode.CAPTURE_NORMAL);
// Get the value range of the property value of CaptureSetting.EV_INTERVAL and return a List < EVInterval >InstaCameraManager.getInstance().getSupportEVIntervalList(CaptureMode.TIMELAPSE);
// Get the value range of the attribute value of CaptureSetting. AEB and return a List < AEB >InstaCameraManager.getInstance().getSupportAEBList(CaptureMode.TIMELAPSE);
// Get the value range of the CaptureSetting. WB attribute and return a List < WB >InstaCameraManager.getInstance().getSupportWBList(CaptureMode.TIMELAPSE);
// Gets the property value range of CaptureSetting.INTERNAL_SPLICING and returns a List < InternalSplicing >InstaCameraManager.getInstance().getSupportInternalSplicingList(CaptureMode.TIMELAPSE);
// Gets the value range of the CaptureSetting.DARK_EIS_ENABLE property and returns a List < DarkEisType >InstaCameraManager.getInstance().getSupportDarkEisList(CaptureMode.TIMELAPSE);
// Gets the property value range of CaptureSetting.BURST_CAPTURE, returns a List < BurstCapture >InstaCameraManager.getInstance().getSupportBurstCaptureList(CaptureMode.TIMELAPSE);
// Get the property value range of CaptureSetting.I_LOG and return a List<ILogStatus> listInstaCameraManager.getInstance().getSupportILogStatusList(CaptureMode.TIMELAPSE);// Get the camera type, such as: Insta360 X4StringcameraType = InstaCameraManager.getInstance().getCameraType();
// Get enumerationCameraTypetype = CameraType.getForType(cameraType);InstaCameraManager.getInstance().getCameraSerial();// Get the camera firmware version, e.g. 0.9.24StringfwVersion = InstaCameraManager.getInstance().getCameraVersion();// Get the camera activation time; the inactive time is 0.longactiveTime = InstaCameraManager.getInstance().getActiveTime();// Get the total space size of the SD cardlongtotalSpace = InstaCameraManager.getInstance().getCameraStorageTotalSpace();// Get the free space size of the SD cardlongfreeSpace = InstaCameraManager.getInstance().getCameraStorageFreeSpace();
// Get the remaining space size of the SD card (for photos, the unit is shots; for videos, the return value is the remaining recording time)intremaining= InstaCameraManager.getInstance().getRemaining(CaptureModecaptureMode);// Get battery type// THICK = 0; //Thick battery// THIN = 1; //Thin battery (camera default)// VERTICAL; //Vertical shot battery// NONE; //Only USB power supply without batteryInstaCameraManager.getInstance().getBatteryType();
// Get current battery: 0-100intlevel = InstaCameraManager.getInstance().getCameraCurrentBatteryLevel();// Get camera system timelongmediaTime = InstaCameraManager.getInstance().getMediaTime();// Check if the camera is chargingbooleanisCharging = InstaCameraManager.getInstance().isCameraCharging();// Check if the camera is workingbooleanisWorking = InstaCameraManager.getInstance().isCameraWorking();
//Check if the specified capturing mode is currently workingbooleanisNormalCapturing = InstaCameraManager.getInstance().isCameraWorking(CaptureMode.CAPTURE_NORMAL);// Check if the SD card is usablebooleanisEnable = InstaCameraManager.getInstance().isSdCardEnabled();You can register/unregister theICameraChangedCallback on multiple pages to monitor changes in the camera status.
publicabstractclassBaseObserveCameraActivityextendsAppCompatActivityimplementsICameraChangedCallback {
@OverrideprotectedvoidonCreate(@NullableBundlesavedInstanceState) {
super.onCreate(savedInstanceState);
InstaCameraManager.getInstance().registerCameraChangedCallback(this);
}
@OverrideprotectedvoidonDestroy() {
super.onDestroy();
InstaCameraManager.getInstance().unregisterCameraChangedCallback(this);
}
/** * Camera status change * * @param enabled: whether the camera is available * @param connectType: connection type */@OverridepublicvoidonCameraStatusChanged(booleanenabled, intconnectType) {
}
/** * Camera coneection failure * <p> * A common scenario is that another phone or another application on this phone has already established a connection with the camera, leading to a failure in establishing the connection, in which case, other phones must first disconnect from this camera. * @param errorCode: Error code, refer to the camera connection error code */@OverridepublicvoidonCameraConnectError(interrorCode) {
}
/** * SD card insertion notification * * @param enabled: whether the current SD card is available */@OverridepublicvoidonCameraSDCardStateChanged(booleanenabled) {
}
/** * SD card storage status change * * @param freeSpace: the current available capacity * @param totalSpace: the total capacity */@OverridepublicvoidonCameraStorageChanged(longfreeSpace, longtotalSpace) {
}
/** * Low battery notification */@OverridepublicvoidonCameraBatteryLow() {
}
/** * Camera power change notification * * @param batteryLevel: current power level(0-100,always returns 100 when charging) * @param isCharging: whether the camera is charging */@OverridepublicvoidonCameraBatteryUpdate(intbatteryLevel, booleanisCharging) {
}
/** * Camera temperature change notification * * @param tempLevel: temperature level */@OverridepublicvoidonCameraTemperatureChanged(TemperatureLeveltempLevel) {
}
}Camera lenses are divided into the following three types:
- Panoramic lens:
SensorMode.PANORAMA - Front camera:
SensorMode.FRONT - Rear lens:
SensorMode.REAR
// Get the current sensor modeSensorModesensorMode = InstaCameraManager.getInstance().getCurrentSensorMode();
// Determine whether it is single sensor modeInstaCameraManager.getInstance().isCameraSingleSensorMode();
// Determine whether it is dual sensor modeInstaCameraManager.getInstance().isCameraDualSensorMode();Note: The SDK currently only supports panoramic lenses. Unknown issues may occur with non-panoramic lenses. Please switch to using the SDK under panoramic lenses.
// Switch to camera panorama lensInstaCameraManager.getInstance().switchPanoramaSensorMode(newICameraOperateCallback() {
@OverridepublicvoidonSuccessful() {
// Lens switch successful
}
@OverridepublicvoidonFailed() {
// Lens switch failed
}
@OverridepublicvoidonCameraConnectError() {
// Camera connection error
}
});Note: Must be used with
Media SDK.
After successfully connecting the camera, you can manipulate the camera preview stream like this.
If the camera is passively disconnected, or if
closeCamera()is called directly during the preview, the SDK will automatically turn off the preview stream processing related state without callingclosePreviewStream()。
Note: The following code only enables the preview stream and cannot display the preview content. You need to use the InstaCapturePlayerView control of MediaSDK to display the preview content.
publicclassPreviewActivityextendsBaseObserveCameraActivityimplementsIPreviewStatusListener {
@OverrideprotectedvoidonCreate(@NullableBundlesavedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preview);
// Open previewInstaCameraManager.getInstance().setPreviewStatusChangedListener(this);
InstaCameraManager.getInstance().startPreviewStream(PreviewStreamResolution.STREAM_1440_720_30FPS, InstaCameraManager.PREVIEW_TYPE_NORMAL);
}
@OverrideprotectedvoidonStop() {
super.onStop();
if (isFinishing()) {
// Close previewInstaCameraManager.getInstance().setPreviewStatusChangedListener(null);
InstaCameraManager.getInstance().closePreviewStream();
}
}
@OverridepublicvoidonOpening() {
// Preview stream is opening
}
@OverridepublicvoidonOpened() {
// The preview stream has been opened and can be played
}
@OverridepublicvoidonIdle() {
// Preview stream has stopped
}
@OverridepublicvoidonError() {
// Preview failed
}
@OverridepublicvoidonExposureData(ExposureDataexposureData) {
// Callback frequency 500Hz// exposureData.timestamp: Time after the camera is turned on// exposureData.exposureTime: Rolling shutter exposure time
}
@OverridepublicvoidonGyroData(List<GyroData> gyroList) {
// Callback frequency 10Hz, 50 data per group// gyroData.timestamp: Time after the camera is turned on// gyroData.ax, gyroData.ay, gyroData.az: Triaxial acceleration// gyroData.gx, gyroData.gy, gyroData.gz: Three-axis gyroscope
}
@OverridepublicvoidonVideoData(VideoDatavideoData) {
// Callback frequency 500Hz// videoData.timestamp: Time after the camera is turned on// videoData.data: Preview raw stream data per frame// videoData.size: Length of each frame of data
}
}intpreviewStatus = InstaCameraManager.getInstance().getPreviewStatus();
// Preview status// InstaCameraManager.PREVIEW_STATUS_IDLE:Preview stream is not opening// InstaCameraManager.PREVIEW_STATUS_OPENING:Preview stream is opening// InstaCameraManager.PREVIEW_STATUS_OPENED:The preview stream has been openedThere are three types of preview streams:
PREVIEW_TYPE_NORMAL:For normal preview or capturingPREVIEW_TYPE_RECORD:Only for recordingPREVIEW_TYPE_LIVE:LIVE
You need to use the following code to get real-time support for camera resolution
List<PreviewStreamResolution> supportedList = InstaCameraManager.getInstance().getSupportedPreviewStreamResolution(InstaCameraManager.PREVIEW_TYPE_LIVE);Note: For X4 and X5, the preview stream resolution cannot be adjusted. The default setting for X4 is 2880x1440, and the default setting for X5 is 2656x1328. The X3 can be manually set to 3840x1920/1440x720.
//Set resolution and preview stream typeInstaCameraManager.getInstance().startPreviewStream( PreviewStreamResolution.STREAM_368_368_30FPS, InstaCameraManager.PREVIEW_TYPE_LIVE );
You can set whether to turn on audio during preview.
PreviewParamsBuilderbuilder = newPreviewParamsBuilder()
.setStreamResolution(PreviewStreamResolution.STREAM_368_368_30FPS)
.setPreviewType(InstaCameraManager.PREVIEW_TYPE_LIVE)
// Whether to turn on audio
.setAudioEnabled(true);
InstaCameraManager.getInstance().startPreviewStream(builder);CaptureModecaptureMode = InstaCameraManager.getInstance().getCurrentCaptureMode();
// The current SDK supports the following capturing modes. Specific camera models may exhibit slight variations; refer to your camera's display for exact details:NormalCapture:CaptureMode.CAPTURE_NORMALHDRCapture:CaptureMode.HDR_CAPTURENightScene:CaptureMode.NIGHT_SCENEBurstMode:CaptureMode.BURSTIntervalShooting:CaptureMode.INTERVAL_SHOOTINGStarlapseShooting:CaptureMode.STARLAPSE_SHOOTINGNormalVideoRecording:CaptureMode.RECORD_NORMALHDRRecording:CaptureMode.HDR_RECORDBulletTime:CaptureMode.BULLETTIMETimelapseMode:CaptureMode.TIMELAPSETimeShiftMode:CaptureMode.TIME_SHIFTLoopRecordingMode:CaptureMode.LOOPER_RECORDINGSuperRecording:CaptureMode.SUPER_RECORDSlowMotion:CaptureMode.SLOW_MOTIONSelfieTrackingMode:CaptureMode.SELFIE_RECORDPureVideoMode (NightScene):CaptureMode.PURE_RECORDLIVE:CaptureMode.LIVEInstaCameraManager.getInstance().setCaptureMode(captureMode, errorCode -> {
if (errorCode == 0) {
// Switching successful
} else {
// Switching failed
}
});Note: For the X3 and earlier camera models, videos exceeding 30 minutes will be split into two recordings. The camera will automatically stop recording the first segment and begin recording the second segment.
InstaCameraManager.getInstance().setCaptureStatusListener(newICaptureStatusListener() {
@OverridepublicvoidonCaptureCountChanged(intcaptureCount) {
// Number of shots captured for modes such as interval shooting and starry sky mode,
}
@OverridepublicvoidonCaptureStarting() {
// Capture is about to start
}
@OverridepublicvoidonCaptureStopping() {
// Capture is about to stop
}
@OverridepublicvoidonCaptureTimeChanged(longcaptureTime) {
// Recording time callback, applicable only in video recording mode
}
@OverridepublicvoidonCaptureWorking() {
// Capturing in progress
}
@OverridepublicvoidonCaptureFinish(String[] filePaths) {
// Capture finished, returns the file paths of the final products
}
@OverridepublicvoidonCaptureError(interrorCode) {
// capturing failed error reference capturing failed error code
}
});The current SDK supports the following capturing properties:
- Exposure Mode:
CaptureSetting.EXPOSURE
FULL_AUTO = Exposure.FULL_AUTO, // Full Auto
AUTO = Exposure.AUTO, // Auto
ISO_FIRST = Exposure.ISO_FIRST, // ISO Priority
SHUTTER_FIRST = Exposure.SHUTTER_FIRST, // Shutter Priority
MANUAL = Exposure.MANUAL, // Manual
ADAPTIVE = Exposure.ADAPTIVE // Panorama Adaptive Exposure
Full Auto:
Exposure.FULL_AUTOAuto:
Exposure.AUTOISO Priority:
Exposure.ISO_FIRSTShutter Priority:
Exposure.SHUTTER_FIRSTManual:
Exposure.MANUALPanorama Adaptive Exposure:
Exposure.ADAPTIVEEV:
CaptureSetting.EVEV Interval:
CaptureSetting.EV_INTERVALShutter Speed:
CaptureSetting.SHUTTERShutter Mode:
CaptureSetting.SHUTTER_MODE
AUTO = ShutterMode.AUTO, // Auto
SPORT = ShutterMode.SPORT, // Indoor Low-light Stabilization
FASTER = ShutterMode.FASTER // Extra Fast
ISO:
CaptureSetting.ISOMax ISO:
CaptureSetting.ISO_TOP_LIMITVideo Resolution & Frame Rate:
CaptureSetting.RECORD_RESOLUTIONPhoto Resolution:
CaptureSetting.PHOTO_RESOLUTIONWhite Balance:
CaptureSetting.WBAEB:
CaptureSetting.AEBInterval Duration:
CaptureSetting.INTERVALColor Mode:
CaptureSetting.GAMMA_MODE
STAND = GammaMode.STAND, // Standard
VIVID = GammaMode.VIVID, // LOG
LOG = GammaMode.LOG, // Vivid
FLAT = GammaMode.FLAT // Flat
- Photo Format:
CaptureSetting.RAW_TYPE
JPG = RawType.OFF, // JPG
JPG_RAW = RawType.DNG, // JPG & RAW
PURESHOT = RawType.PURESHOT, // PURESHOT
PURESHOT_RAW = RawType.PURESHOT_RAW, // PURESHOT & RAW
INSP = RawType.INSP, // INSP
INSP_RAW = RawType.INSP_RAW // RAW & INSP
Recording Duration:
CaptureSetting.RECORD_DURATIONLow Light Stabilization:
CaptureSetting.DARK_EIS_ENABLEPanorama Adaptive Exposure:
CaptureSetting.PANO_EXPOSURE_MODE
OFF = PanoExposureMode.OFF, // Off
ON = PanoExposureMode.ON, // Independent Exposure
LIGHT = PanoExposureMode.LIGHT, // Standard
LSOLATED = PanoExposureMode.LSOLATED // High
Note: For cameras prior to Insta360 X4, only ON and OFF were supported. From X4 onwards, ON is split into LIGHT and LSOLATED.
Burst Capture Count:
CaptureSetting.BURST_CAPTUREIn-camera Splicing:
CaptureSetting.INTERNAL_SPLICING
ON = InternalSplicing.ON, // On
OFF = InternalSplicing.OFF // Off
- Video HDR Mode:
CaptureSetting.HDR_STATUS
ON = HdrStatus.ON, // On
OFF = HdrStatus.OFF // Off
Note: From Insta360 X5 onwards,
CaptureMode.HDR_RECORDis removed. UseCaptureSetting.HDR_STATUSinstead.
- Photo HDR Mode:
CaptureSetting.PHOTO_HDR_TYPE
On: PhotoHdrType.HDR_ON
Off: PhotoHdrType.HDR_OFF
AEB: PhotoHdrType.HDR_AEB
Note: From Insta X5 onwards,
CaptureMode.HDR_CAPTUREis removed. UseCaptureSetting.PHOTO_HDR_TYPEinstead.
- I-LOG:
CaptureSetting.I_LOG
ON = ILogStatus.ON, // On
OFF = ILogStatus.OFF // Off
- Photo Countdown:
CaptureSetting.LATENCY
Note: Only supported on X5
You can use the InstaCameraManager.getInstance().getXxx(CaptureMode) method to retrieve the corresponding capturing properties.
| Method | Parameter | Return Type | Description |
|---|---|---|---|
| getRecordDuration() | CaptureMode | RecordDuration | Get recording duration |
| getRecordResolution() | CaptureMode | RecordResolution | Get video resolution and frame rate |
| getPhotoResolution() | CaptureMode | PhotoResolution | Get photo resolution |
| getInterval() | CaptureMode | Interval | Get capturing interval duration |
| getHdrStatus() | CaptureMode | HdrStatus | Get HDR status for normal video recording |
| getPhotoHdrType() | CaptureMode | PhotoHdrType | Get HDR status for normal photo capture |
| getGammaMode() | CaptureMode | GammaMode | Get color mode |
| getRawType() | CaptureMode | RawType | Get photo format |
| getPanoExposureMode() | CaptureMode | PanoExposureMode | Get panorama independent exposure status |
| getExposure() | CaptureMode | Exposure | Get exposure mode |
| getISO() | CaptureMode | ISO | Get ISO value |
| getISOTopLimit() | CaptureMode | ISOTopLimit | Get ISO upper limit |
| getShutterMode() | CaptureMode | ShutterMode | Get shutter mode |
| getShutter() | CaptureMode | Shutter | Get shutter speed |
| getEv() | CaptureMode | Ev | Get EV value |
| getEVInterval() | CaptureMode | EVInterval | Get EV interval |
| getAEB() | CaptureMode | AEB | Get AEB |
| getWB() | CaptureMode | WB | Get white balance |
| getInternalSplicingEnable() | CaptureMode | InternalSplicing | Get in-camera stitching status |
| getDarkEisType() | CaptureMode | DarkEisType | Get low-light stabilization status |
| getBurstCapture() | CaptureMode | BurstCapture | Get burst mode parameters |
| getILogStatus() | CaptureMode | ILogStatus | Get the I-LOG Switch |
| getLatency() | CaptureMode | Latency | Get the photo countdown |
You can use the*InstaCameraManager.getInstance().setXxx(CaptureMode)* method to set the corresponding capturing properties.
| Method | Parameter 1 | Parameter 2 | Return Type | Description |
|---|---|---|---|---|
| setRecordDuration() | CaptureMode | RecordDuration | void | Set recording duration |
| setRecordResolution() | CaptureMode | RecordResolution | void | Set video resolution and frame rate |
| setPhotoResolution() | CaptureMode | PhotoResolution | void | Set photo resolution |
| setInterval() | CaptureMode | Interval | void | Set capturing interval duration |
| setHdrStatus() | CaptureMode | HdrStatus | void | Set HDR status for normal video |
| setPhotoHdrType() | CaptureMode | PhotoHdrType | void | Set HDR status for normal photo |
| setGammaMode() | CaptureMode | GammaMode | void | Set color mode |
| setRawType() | CaptureMode | RawType | void | Set photo format |
| setPanoExposureMode() | CaptureMode | PanoExposureMode | void | Set panorama independent exposure status |
| setExposure() | CaptureMode | Exposure | void | Set exposure mode |
| setISO() | CaptureMode | ISO | void | Set ISO value |
| setISOTopLimit() | CaptureMode | ISOTopLimit | void | Set ISO upper limit |
| setShutterMode() | CaptureMode | ShutterMode | void | Set shutter mode |
| setShutter() | CaptureMode | Shutter | void | Set shutter speed |
| setEv() | CaptureMode | Ev | void | Set EV value |
| setEVInterval() | CaptureMode | EVInterval | void | Set EV interval |
| setAEB(CaptureMode | CaptureMode | AEB | void | Set AEB |
| setWB() | CaptureMode | WB | void | Set white balance |
| setInternalSplicingEnable() | CaptureMode | InternalSplicing | void | Set in-camera stitching |
| setDarkEisType() | CaptureMode | DarkEisType | void | Set low-light stabilization |
| setBurstCapture() | CaptureMode | BurstCapture | void | Set burst mode parameters |
| setILogStatus | CaptureMode | ILogStatus | void | Setting the I-LOG switch |
| setLatency() | CaptureMode | Latency | void | Set a photo countdown |
//Start batch setting of capturing propertiesInstaCameraManager.getInstance().beginSettingOptions();
InstaCameraManager.getInstance().setEv(captureMode, EV.EV_0);
InstaCameraManager.getInstance().setShutter(captureMode, Shutter.SHUTTER_1_2);
...
InstaCameraManager.getInstance().setWB(captureMode, WB.WB_2200K);
//Submit batch settings to take effectInstaCameraManager.getInstance().commitSettingOptions();There are interdependencies among different capturing properties. Setting property A may affect the support list of property B. Therefore, after setting a property, it is necessary to check the other affected properties.
Note: Since the callback function may be invoked multiple times, the elements in the CaptureSetting list may differ each time it is called.
Example:
// The example only demonstrates setting PhotoHdrType; other property settings follow the same pattern;InstaCameraManager.getInstance().setPhotoHdrType(captureMode, photoHdrType, newInstaCameraManager.IDependChecker() {
@Overridepublicvoidcheck(List<CaptureSetting> captureSettings) {
// captureSettings:list of affected capturing properties// UI updates can be handled here
}
});booleanisPhotoMode = CaptureMode.PURE_RECORD.isPhotoMode();// Start Normal capture
InstaCameraManager.getInstance().startNormalCapture();
// Start HDR capture
InstaCameraManager.getInstance().startHDRCapture();
// Start super night scene
InstaCameraManager.getInstance().startNightScene();
// Start burst capture
InstaCameraManager.getInstance().startBurstCapture();
// Start Interval Shooting
InstaCameraManager.getInstance().startIntervalShooting();
// Stop interval shooting
InstaCameraManager.getInstance().stopIntervalShooting();
// Start starlapse shooting
InstaCameraManager.getInstance().startStarLapseShooting();
// Stop starlapse shooting
InstaCameraManager.getInstance().stopStarLapseShooting();
booleanisVideoMode = CaptureMode.PURE_RECORD.isVideoMode();// Start normal recording
InstaCameraManager.getInstance().startNormalRecord();
// Stop normal recording
InstaCameraManager.getInstance().stopNormalRecord();
// Start HDR recording
InstaCameraManager.getInstance().startHDRRecord();
// Stop HDR recording
InstaCameraManager.getInstance().stopHDRRecord();
// Start Bullet Time
InstaCameraManager.getInstance().startBulletTime();
// Stop Bullet Time
InstaCameraManager.getInstance().stopBulletTime();
// Start timelapse recording
InstaCameraManager.getInstance().startTimeLapse();
// Stop timelapse recording
InstaCameraManager.getInstance().stopTimeLapse();
// Start time shift recording
InstaCameraManager.getInstance().startTimeShift();
// Stop time shift recording
InstaCameraManager.getInstance().stopTimeShift();
// Start loop recording
InstaCameraManager.getInstance().startLooperRecord();
// Stop loop recording
InstaCameraManager.getInstance().stopLooperRecord();
// Start super recording
InstaCameraManager.getInstance().startSuperRecord();
// Stop super recording
InstaCameraManager.getInstance().stopSuperRecord();
// Start slow motion recording
InstaCameraManager.getInstance().startSlowMotionRecord();
// Stop slow motion recording
InstaCameraManager.getInstance().stopSlowMotionRecord();
// Start selfie tracking mode
InstaCameraManager.getInstance().startSelfieRecord();
// Stop selfie tracking mode
InstaCameraManager.getInstance().stopSelfieRecord();
// Start night scene recording
InstaCameraManager.getInstance().startPureRecord();
// Stop night scene recording
InstaCameraManager.getInstance().stopPureRecord();
Note: Required to use with the
Media SDK.
booleanisLiveMode = CaptureMode.PURE_RECORD.isLiveMode();Note: After the preview stream is turned off, the camera will automatically switch the capturing mode to normal recording. Before starting LIVE, you need to check whether the current capturing mode is LIVE. Specific parameters are set using CaptureSetting.
InstaCameraManager.getInstance().startLive(rtmp, netid, newILiveStatusListener() {
@OverridepublicvoidonLiveFpsUpdate(intfps) {
// fps:当前直播帧率
}
@OverridepublicvoidonLivePushError(interror, Stringdesc) {
// 直播推流失败
}
@OverridepublicvoidonLivePushFinished() {
// 直播推流结束
}
@OverridepublicvoidonLivePushStarted() {
// 直播推流开始
}
});InstaCameraManager.getInstance().stopLive();// Return value example:http://192.168.42.1:80InstaCameraManager.getInstance().getCameraHttpPrefix();// Return value example:[/DCIM/Camera01/VID_20250326_184618_00_001.insv]List<String> usls = InstaCameraManager.getInstance().getAllUrlList();
// Includes files in the videoList<String> usls = InstaCameraManager.getInstance().getAllUrlListIncludeRecording();// Delete a single camera fileInstaCameraManager.getInstance().deleteFile(StringfilePath,newICameraOperateCallback() {
@OverridepublicvoidonSuccessful() {
// Delete successfully
}
@OverridepublicvoidonFailed() {
// Delete failed
}
@OverridepublicvoidonCameraConnectError() {
// Camera connection error
}
});
// Batch delete camera filesInstaCameraManager.getInstance().deleteFileList(List<String> fileUrlList,newICameraOperateCallback() {
@OverridepublicvoidonSuccessful() {
// Delete successfully
}
@OverridepublicvoidonFailed() {
// Delete failed
}
@OverridepublicvoidonCameraConnectError() {
// Camera connection error
}
});The SDK's log system supports saving logs to local files. Call the following code to set the log save location.
// Set the log cache path. If not set, no cache will be performed.LogManager.instance.setLogRootPath(StorageUtils.getInternalRootPath() + "/log");Enable the global log real-time capture function, which will capture all logs, including SDK logs, system logs, host APP logs, etc., and save them in the directory specified above.
// Enable real-time log captureLogManager.instance.startLogDumper();
// Stop real-time log captureLogManager.instance.stopLogDumper();// android.location.Location class,developer obtains it via system APILocationlocation;
// Set GPS data when taking a photoGpsDatagpsData = newGpsData();
gpsData.setLatitude(location.getLatitude());
gpsData.setLongitude(location.getLongitude());
gpsData.setAltitude(location.getAltitude());
InstaCameraManager.getInstance().startNormalCapture(gpsData.simpleGpsDataToByteArray());// Start normal capturing and input GPS data.
InstaCameraManager.getInstance().startNormalCapture(byte[]);
// Start HDR capturing and input GPS data.
InstaCameraManager.getInstance().startHDRCapture(byte[]);
// Start burst capturing and input GPS data.
InstaCameraManager.getInstance().startBurstCapture(byte[]);
// Start interval shooting and input GPS data.
InstaCameraManager.getInstance().stopIntervalShooting(byte[]);
GPS data for recording settings can be divided into the following two situations:
Stopping recording is the same as taking photos. The example code is as follows:
// android.location.Location class, developer obtains it via system APILocationlocation;
// Set GPS data when stopping the recordingGpsDatagpsData = newGpsData();
gpsData.setLatitude(location.getLatitude());
gpsData.setLongitude(location.getLongitude());
gpsData.setAltitude(location.getAltitude());
InstaCameraManager.getInstance().stopNormalRecord(gpsData.simpleGpsDataToByteArray());GPS data can be set at any time in the video recording. GPS data is usually used to create the camera's motion trajectory. Therefore, it is recommended to set the GPS interval as much as possible each time. The example code is as follows:
// Collect GPS data every 100ms; once 20 GPS data points are accumulated, send them to the cameraprivateHandlermMainHandler = newHandler(Looper.getMainLooper());
// List of GPS dataprivateList<GpsData> mCollectGpsDataList = newArrayList<GpsData>();
privateRunnablemCollectGpsDataRunnable = newRunnable() {
@Overridepublicvoidrun() {
// android.location.Location class, developer obtains it via system APILocationlocation;
if (location != null) {
GpsDatagpsData = newGpsData();
gpsData.setLatitude(location.getLatitude());
gpsData.setLongitude(location.getLongitude());
gpsData.setSpeed(location.getSpeed());
gpsData.setBearing(location.getBearing());
gpsData.setAltitude(location.getAltitude());
gpsData.setUTCTimeMs(location.getTime());
gpsData.setVaild(true);
mCollectGpsDataList.add(gpsData);
if (mCollectGpsDataList.size() >= 20) {
InstaCameraManager.getInstance().setGpsData(GpsData.gpsDataToByteArray(mCollectGpsDataList));
mCollectGpsDataList.clear();
}
}
mMainHandler.postDelayed(this, 100);
}
};
// Start collecting GPS datamMainHandler.post(mCollectGpsDataRunnable);// Stop normal recording and input GPS data.
InstaCameraManager.getInstance().stopNormalRecord(byte[]);
// Stop HDR recording and input GPS data.
InstaCameraManager.getInstance().stopHDRRecord(byte[]);
// Stop Bullet Time and input GPS data.
InstaCameraManager.getInstance().stopBulletTime(byte[]);
// Stop Timelapse and input GPS data.
InstaCameraManager.getInstance().stopTimeLapse(byte[]);
// Stop Time Shift and input GPS data.
InstaCameraManager.getInstance().stopTimeShift(byte[]);
// Stop super Recording and input GPS data.
InstaCameraManager.getInstance().stopSuperRecord(byte[]);
// Stop loop Recording and input GPS data.
InstaCameraManager.getInstance().stopLooperRecord(byte[]);
// Stop night Scene recording and input GPS data.
InstaCameraManager.getInstance().stopPureRecord(byte[]);
// Stop selfie tracking recording and input GPS data.
InstaCameraManager.getInstance().stopSelfieRecord(byte[]);
Activating the camera requires the use of two pieces of data, appIdand secretKey. These two data need to be applied for by the official Insta360.
Note: Activation requires network permissions
Note: Nano S cameras do not support this feature.
Example code is as follows:
Stringappid = "xxxxxxxx";
StringmSecretKey = "xxxxxxx";
InstaCameraManager.getInstance().activateCamera(newSecretInfo(appid , mSecretKey), newInstaCameraManager.IActivateCameraCallback() {
@OverridepublicvoidonStart() {
// Began to activate
}
@OverridepublicvoidonSuccess() {
// Activation successful
}
@OverridepublicvoidonFailed(Stringmessage) {
// Activation failed
}
});Note: The Nano S camera does not support the prompt sound switch, but supports the setting.
The switch for camera prompt sound. Example code is as follows:
// Turn on the camera prompt toneInstaCameraManager.getInstance().setCameraBeepSwitch(true);
// Determine whether the camera has a prompt tone turned onbooleanisBeep = InstaCameraManager.getInstance().isCameraBeep();InstaCameraManager.getInstance().formatStorage(newICameraOperateCallback() {
@OverridepublicvoidonSuccessful() {
// SD card formatted successfully
}
@OverridepublicvoidonFailed() {
// SD card formatting failed
}
@OverridepublicvoidonCameraConnectError() {
// Camera connection error
}
});Note: Nano S cameras do not support this feature.
After the camera is locked, the user cannot operate the camera screen. Example code is as follows:
// true: lock screen false: unlock screenInstaCameraManager.getInstance().setCameraLockScreen(true);Instructions to control camera shutdown, sample code is as follows:
Note: Only Insta360X5 and later cameras support this feature.
InstaCameraManager.getInstance().shutdownCamera();Note: Nano S cameras do not support this feature.
When the camera is connected to Wi-Fi, this function should be used. Before calibration, make sure the camera is placed vertically on a stable and horizontal surface.
InstaCameraManager.getInstance().calibrateGyro(newICameraOperateCallback() {
@OverridepublicvoidonSuccessful() {
}
@OverridepublicvoidonFailed() {
}
@OverridepublicvoidonCameraConnectError() {
}
});Use the FwUpgradeManager class to upgrade the firmware version. The example code is as follows:
Note: Nano S cameras do not support this feature.
Note: Please make sure to upload the correct files to the camera to prevent any potential damage. For example, do not upload the ONE X firmware upgrade package to the ONE X2 camera.
// Determine if an upgrade is in progressFwUpgradeManager.getInstance().isUpgrading();
// Cancel the upgradeFwUpgradeManager.getInstance().cancelUpgrade();
StringfwFilePath = "/xxx/InstaOneXFW.bin";
// Upgrade firmwareFwUpgradeManager.getInstance().startUpgrade(fwFilePath, newFwUpgradeListener() {
@OverridepublicvoidonUpgradeSuccess() {
// Callback after successful upgrade
}
@OverridepublicvoidonUpgradeFail(interrorCode, Stringmessage) {
// Upgrade failure callback// Firmware error code
}
@OverridepublicvoidonUpgradeCancel() {
// Upgrade cancel callback
}
@OverridepublicvoidonUpgradeProgress(doubleprogress) {
// Upgrade progress callback: 0-1
}
});| Error Code | Explanation |
|---|---|
| -122 | Bluetooth device disconnected |
| 501 | Bluetooth disconnection occurred |
| 2201 | System error BleException.ERROR_CODE_SYSTEM_STATUS_133 |
| 2002 | Open camera timed out |
| 2206 | System error BleException.ERROR_CODE_NOTIFY_FAILURE |
| 2207 | System error BleException.ERROR_CODE_SHAKE_HAND |
| 3201 | Socket connection failed |
| 3205 | Socket connection timed out |
| 3206 | Socket reconnect timed out |
| 4001 | System error BleException.ERROR_CODE_SYNC_PACK |
| 4101 | Camera type error |
| 4103 | Camera sync parameter timed out |
| 4402 | Camera operating system error |
| 4403 | Camera is occupied |
| 4405 | Parsing proto failed |
| 4406 | Camera sync parameter retry timeout |
| 4407 | Camera data exception |
| 4414 | Failed to wake up Bluetooth |
| 4417 | Camera disconnected during operation |
| 4504 | Camera disconnected when connected |
| 4505 | Bluetooth binding rejected |
| 4507 | Bluetooth write failed |
| 4508 | Device Bluetooth busy |
| 4602 | Device Wi-Fi busy |
| 4605 | USBerror |
| 4606 | Socket Disconnected Due to Dirty Data |
| -14169 | Failed to synchronize camera parameters due to Bluetooth failure |
| Error Code | Explanation |
|---|---|
| -1000 | Already upgrading |
| -1001 | Camera not connected |
| -1002 | When the camera battery is below 12%, the upgrade will fail, please make sure the camera battery is fully charged |
| -14004 | Http server error |
| 400 | Http server error |
| 500 | Http server error |
| -14005 | Socket IO exception |
| Error Code | Explanation |
|---|---|
| -14161 | Low battery |
| -14162 | Exceeded the maximum recording time limit |
| -14163 | SD card is full |
| -14165 | Exceeded the file limit |
| -14166 | SD card speed is low |
| -14167 | Coding anomaly |
| -14168 | Frame loss |
| -14180 | Excessive file fragmentation |
| -14181 | Camera temperature is too high |
| -14182 | Low power start |
| -14183 | Storage Deflection Start |
| -14184 | High temperature start |
| -14164 | Other situations |
| Error Code | Explanation |
|---|---|
| 400 | Parameter error, possibly due to the camera type or serial number not being obtained |
| 401 | Interface signature verification failed |
| 402 | Data encryption verification failed |
| 403 | The nonce credential has already been used |
| 406 | The timestamp has expired |
| 429 | Frequent interface requests |
| 500 | Internal system exception |
| 3001 | Device serial number does not match device type |
| 3002 | Camera has been activated |
| 3003 | Activation denied; IP address is not within a valid region |
| 3004 | Unable to generate a valid serial number |
| 3005 | The system does not support activating devices of this model |
| 3006 | The serial number has been locked by the backend and cannot be activated |
| 429 | The activation IP is subject to rate limiting. Rate limiting policy: 45 attempts per IP per day |
- Add the maven address to the build file (
build.gradlefile in the project root directory)
allprojects {
repositories {
...
maven {
url 'XXXXXX'
credentials {
// see sdk demo
username ='***'
password ='***'
}
}
}
}- Import the dependency library in the
build.gradlefile of the app directory
dependencies {
implementation 'com.arashivision.sdk:sdkmedia:x.x.x'
}If you have integrated the Camera SDK, you can open and display the preview content.
You need to put *InstaCapturePlayerView*into your XML file and bind the lifecycle of the Activity:
<com.arashivision.sdkmedia.player.capture.InstaCapturePlayerView
android:id="@+id/player_capture"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@android:color/darker_gray"
/>
@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preview);
mCapturePlayerView.setLifecycle(getLifecycle());
}Show preview screen in IPreviewStatusListener.onOpen() callback of Camera SDK
@OverridepublicvoidonOpened() {
InstaCameraManager.getInstance().setStreamEncode();
mCapturePlayerView.setPlayerViewListener(newPlayerViewListener() {
@OverridepublicvoidonLoadingFinish() {
// Fixed writingInstaCameraManager.getInstance().setPipeline(mCapturePlayerView.getPipeline());
}
@OverridepublicvoidonLoadingStatusChanged(booleanisLoading) {
// loading status change
}
@OverridepublicvoidonFail(Stringdesc) {
}
@OverridepublicvoidonFirstFrameRender() {
// First frame rendered successfully
}
});
// Set parameters, which will be described in detail latermCapturePlayerView.prepare(createParams());
// PlaymCapturePlayerView.play();
// Keep the screen always onmCapturePlayerView.setKeepScreenOn(false);
}When closing the preview stream, you need to release the InstaCapturePlayerView
@OverrideprotectedvoidonStop() {
super.onStop();
if (isFinishing()) {
InstaCameraManager.getInstance().setPreviewStatusChangedListener(null);
InstaCameraManager.getInstance().closePreviewStream();
mCapturePlayerView.destroy();
}
}
// yilanli@OverridepublicvoidonIdle() {
mCapturePlayerView.destroy();
mCapturePlayerView.setKeepScreenOn(false);
}privateCaptureParamsBuilderV2createParams() {
CaptureParamsBuilderV2builder = newCaptureParamsBuilderV2()
// (Optional) Set your resolution and frame rate. The default values are generated intelligently by the SDK.
.setWidth(intwidth)
.setHeight(intheight)
.setFps(intfps) //Max 30fps// (optional) achromatic Default value is true
.setImageFusionEnabled(booleanenable)
// (Optional) Set the gesture switch. The default value is generated intelligently by the SDK
.setGestureEnabled(booleanenable)
// (Optional) Set the number of frames cached for anti-shake. The more frames cached, the better the anti-shake effect, but the higher the image delay.
.setStabCacheFrameNum(5)
// (Optional) Set the stabilization type. The default value is generated intelligently by the SDK.
.setStabType(@InstaStabType.StabTypeintmStabType)
// (Optional) Set the rendering mode; the default value is “RenderModel.AUTO”.
.setRenderModel(RenderModel.PLANE_STITCH)
// (Optional) Set the screen ratio. For example, 9:16. The default value is generated by the SDK.// If the rendering mode type is “PLANE_STITCH”, it is recommended to set the aspect ratio to 2:1.
.setScreenRatio(int,int)
// (Optional) Set custom Surface information
.setCameraRenderSurfaceInfo(CameraRenderSurfaceInfo);
returnbuilder;
}// OrdinarymCapturePlayerView.switchNormalMode();
// Fish eyemCapturePlayerView.switchFisheyeMode();
// PerspectivemCapturePlayerView.switchPerspectiveMode();You can customize the viewing angle and distance according to your preferences.
Fov: Angle range 0~180
Distance: line of sight range 0~∞
mCapturePlayerView.setConstraint(floatminFov, floatmaxFov, floatdefaultFov, floatminDistance, floatmaxDistance, floatdefaultDistance);You can set PlayerGestureListener to observe gesture actions:
mCapturePlayerView.setGestureListener(newPlayerGestureListener() {
@OverridepublicbooleanonDown(MotionEvente) {
// Use finger press eventreturnPlayerGestureListener.super.onDown(e);
}
@OverridepublicbooleanonTap(MotionEvente) {
// User finger click event, similar to View. OnClickListener. OnClick (v)returnPlayerGestureListener.super.onTap(e);
}
@OverridepublicvoidonUp() {
// User finger lift eventPlayerGestureListener.super.onUp();
}
@OverridepublicvoidonLongPress(MotionEvente) {
// User long press eventPlayerGestureListener.super.onLongPress(e);
}
@OverridepublicvoidonZoom() {
// User two-finger zoom eventPlayerGestureListener.super.onZoom();
}
@OverridepublicvoidonZoomAnimation() {
// Rebound animation when scaling to maximum or minimumPlayerGestureListener.super.onZoomAnimation();
}
@OverridepublicvoidonZoomAnimationEnd() {
// Zoom rebound animation endsPlayerGestureListener.super.onZoomAnimationEnd();
}
@OverridepublicvoidonScroll() {
// User finger swipe eventPlayerGestureListener.super.onScroll();
}
@OverridepublicvoidonFlingAnimation() {
// Fling animationPlayerGestureListener.super.onFlingAnimation();
}
@OverridepublicvoidonFlingAnimationEnd() {
// Quick swipe animation endsPlayerGestureListener.super.onFlingAnimationEnd();
}
});WorkWrapper is a collection of all data in a slice file. For example: Continuous capturing generates multiple files, which are then encapsulated into a single WorkWrapper for unified processing. Subsequent operations such as playback, export, and information retrieval are all performed by manipulating the WorkWrapper object.
You can scan media files from your camera or local directory to obtainList<WorkWrapper>。
Note: This is a time-consuming operation that needs to be handled in a child thread.
// Get from the cameraList<WorkWrapper> list = WorkUtils.getAllCameraWorks();
// Get from local fileList<WorkWrapper> list = WorkUtils.getAllLocalWorks(StringdirPath);
// If you have the URL of the media file, you can also create WorkWrapper yourselfString[] urls = {img1.insv, img2.insv, img3.insv};
WorkWrapperworkWrapper = newWorkWrapper(urls);Call the WorkWrapper.loadExtraData() function to load the file trailer data. The play and export functions can be used only after the file trailer data is loaded.
Call the WorkWrapper.isExtraDataLoaded() function to determine whether the file trailer data has been loaded.
Note: This method is a time-consuming operation and needs to be executed in the IO thread.
The information you can obtain from WorkWrapper is as follows:
| Method | Parameter | Return Value Type | Explanantion |
|---|---|---|---|
| getIdenticalKey() | - | String | For Glide or other DiskCacheKeys |
| getUrls() | - | String[] | Get media file URL |
| getUrls() | boolean | String[] | Get the URL of the media file. Set true/false to determine whether to include the dng file path |
| getAllUrls() | - | String[] | Get all file paths for operations such as downloading and deletion. |
| getWidth() | - | int | Get width |
| getHeight() | - | int | Get height |
| getBitrate() | - | int | Get the video bitrate. If it is a photo, return 0 |
| getFps() | - | double | Get the video frame rate. If it is a photo, return 0 |
| isPhoto() | - | boolean | Whether it is a photo |
| isHDRPhoto() | - | boolean | Is it an HDR photo |
| supportPureShot() | - | boolean | Whether to support PureShot algorithm |
| isVideo() | - | boolean | Whether it is a video |
| isHDRVideo() | - | boolean | Is it HDR video |
| isCameraFile() | - | boolean | Is the media file sourced from the camera device |
| isLocalFile() | - | boolean | Is the media file sourced from a mobile device |
| getCreationTime() | - | long | Obtain media file shooting timestamp, unit: ms |
| getFirstFrameTimeOffset() | - | long | Obtain the offset of timestamp relative to camera startup when shooting media files, used to match gyroscope, exposure, and other data, unit: ms |
| getGyroInfo() | - | GyroInfo[] | Obtain gyroscope data for media files |
| getExposureData() | - | ExposureData[] | Obtain exposure data for media files |
| loadThumbnail() | - | Bitmap | Loading thumbnails (time-consuming operation) |
| loadExtraData() | - | - | Load file trailer data (time-consuming operation) |
| isExtraDataLoaded() | - | boolean | Whether the file trailer data has been loaded |
If you want to play images or videos, you must first create a WorkWrapper。
Put the InstaImagePlayerView into an XML file and bind the lifecycle of the Activity.
<com.arashivision.sdkmedia.player.image.InstaImagePlayerView
android:id="@+id/player_image"android:layout_width="match_parent"android:layout_height="match_parent" />
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preview);
mImagePlayerView.setLifecycle(getLifecycle());
}ImageParamsBuilderbuilder = newImageParamsBuilder()
// (Optional) Whether to enable dynamic stitching, default is true
.setDynamicStitch(booleandynamicStitch)
// (Optional) Set the stabilization type, default is InstaStabType STAB_TYPE_OFF
.setStabType(@InstaStabType.StabTypeintmStabType)
// (Optional) Set the playback proxy file, such as HDR.jpg generated by splicing, which is empty by default
.setUrlForPlay(Stringurl)
// (Optional) Sets the render model type, default is Render_MODE_AUTO
.setRenderModel(RenderModel.PLANE_STITCH)
// (Optional) Set the aspect ratio of the screen, default is full screen display//If the render mode type is "RENDER_mode_PLANE_STITCH", the recommended setting ratio is 2:1
.setScreenRatio(intratioX, intratioY)
// (Optional) Eliminate color difference in image stitching, default is false
.setImageFusion(booleanimageFusion)
// (Optional) Set the lens guards type, default is OffsetType. ORIGINAL
.setOffsetType(OffsetTypeoffsetType)
// (Optional) Set the color enhancement switch; default is false.
.setColorPlusEnable(booleanenabled);
// (Optional) Set the color enhancement intensity, default value is 1, valid range 0-1
.setColorPlusFilterIntensity(floatcolorPlusFilterIntensity);
// (Optional) Whether to allow gesture operations, default is true
.setGestureEnabled(booleanenabled);
// (Optional) thumbnail cache folder, default is getCacheDir () + "/ work_thumbnail "
.setCacheWorkThumbnailRootPath(Stringpath)
// (Optional) Stabilizer data cache folder, default is get CacheD ir () + "/ stabilizer "
.setStabilizerCacheRootPath(Stringpath)
// (Optional) Cache folder, default is getExternalCacheDir () + "/ template_blender "
.setCacheTemplateBlenderRootPath(Stringpath)
// (Optional) Star mode image cache folder, default is getCacheDir () + "/ cut_scene "
.setCacheCutSceneRootPath(Stringpath);WorkWrapper and playback parameters need to be set before playback.
// Set WorkWrapper and playback parametersmImagePlayerView.prepare(workWrapper, newImageParamsBuilder());
// Start playingmImagePlayerView.play();When the Activity is destroyed, release InstaImagePlayerView。
@OverrideprotectedvoidonDestroy() {
super.onDestroy();
mImagePlayerView.destroy();
}Note: If you want to switch between tiling mode and other modes, you must first restart the player.
If the rendering mode you are using is RENDER_MODE_AUTO, you can switch between the following modes.
// Switch to normal modemImagePlayerView.switchNormalMode();
// Switch to fisheye modemImagePlayerView.switchFisheyeMode();
// Switch to perspective modemImagePlayerView.switchPerspectiveMode();
// To switch to tiling mode, you need to restart the playerImageParamsBuilderbuilder = newImageParamsBuilder();
builder.setRenderModelType(ImageParamsBuilder.RENDER_MODE_PLANE_STITCH);
builder.setScreenRatio(2, 1);
mImagePlayerView.prepare(mWorkWrapper, builder);
mImagePlayerView.play();You can customize the viewing angle and distance according to your preferences.
Fov: Angle range 0~180
Distance: line of sight range 0~∞
mImagePlayerView.setConstraint(floatminFov, floatmaxFov, floatdefaultFov, floatminDistance, floatmaxDistance, floatdefaultDistance);You can set the PlayerViewListener to observe changes in the player state.
mImagePlayerView.setPlayerViewListener(newPlayerViewListener() {
@OverridepublicvoidonLoadingStatusChanged(booleanisLoading) {
// Player loading status changed//isLoading:whether loading
}
@OverridepublicvoidonLoadingFinish() {
// Player loading complete
}
@OverridepublicvoidonFail(interrorCode, StringerrorMsg) {
// if GPU not support, errorCode is -10003 or -10005 or -13020// Player error
}
@OverridepublicvoidonFirstFrameRender() {
// First frame rendering successfully
}
});You can set PlayerGestureListener to observe gesture actions:
mImagePlayerView.setGestureListener(newPlayerGestureListener(){
@Overridepublic boolean onDown(MotionEvente){// User finger press eventreturnPlayerGestureListener.super.onDown(e);}
@Overridepublic boolean onTap(MotionEvente){// User finger click event, similar to View.OnClickListener.OnClick(v)returnPlayerGestureListener.super.onTap(e);}
@OverridepublicvoidonUp(){// User finger lift eventPlayerGestureListener.super.onUp();}
@OverridepublicvoidonLongPress(MotionEvente){// User long press eventPlayerGestureListener.super.onLongPress(e);}
@OverridepublicvoidonZoom(){// User two-finger zoom eventPlayerGestureListener.super.onZoom();}
@OverridepublicvoidonZoomAnimation(){// Rebound animation when scaling to maximum or minimumPlayerGestureListener.super.onZoomAnimation();}
@OverridepublicvoidonZoomAnimationEnd(){// Zoom rebound animation endsPlayerGestureListener.super.onZoomAnimationEnd();}
@OverridepublicvoidonScroll(){// User finger swipe eventPlayerGestureListener.super.onScroll();}
@OverridepublicvoidonFlingAnimation(){// Quick slide animationPlayerGestureListener.super.onFlingAnimation();}
@OverridepublicvoidonFlingAnimationEnd(){// Quick swipe animation endsPlayerGestureListener.super.onFlingAnimationEnd();}});Put the *InstaVideoPlayerView *into an XML file and bind the lifecycle of the Activity.
<com.arashivision.sdkmedia.player.video.InstaVideoPlayerView
android:id="@+id/player_video"android:layout_width="match_parent"android:layout_height="match_parent"
/>
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preview);
mVideoPlayerView.setLifecycle(getLifecycle());
}VideoParamsBuilderbuilder = newVideoParamsBuilder()
// (Optional) Load icon, default is empty
.setLoadingImageResId(intresId)
// (Optional) Background color during loading, default is black
.setLoadingBackgroundColor(intcolor)
// (Optional) Whether to play automatically
.setAutoPlayAfterPrepared(booleanautoPlayAfterPrepared)
// (Optional) Set the stabilization type, default is InstaStabType STAB_TYPE_OFF
.setStabType(@InstaStabType.StabTypeintstabType)
// (Optional) Whether to play in loop; default is true
.setIsLooping(booleanisLooping)
// (Optional) Set whether to play the LRV
.setLrvEnable(booleanisLrvEnable)
// (Optional) Whether to enable dynamic stitching, default is true
.setDynamicStitch(booleandynamicStitch)
// (Optional) Eliminate color difference in image stitching, default is false
.setImageFusion(booleanimageFusion)
// (Optional) Set the lens guards type, default is OffsetType. ORIGINAL
.setOffsetType(OffsetTypeoffsetType)
// (Optional) Remove purple fringing. Default value is false. Requires adding an algorithm file.
.setDePurpleFilterOn(booleanisDePurpleFilterOn)
// (Optional) Set the color enhancement switch, default is false
.setColorPlusEnable(booleanenabled);
// (Optional) Set the color enhancement intensity, default value is 1, valid range 0-1
.setColorPlusFilterIntensity(floatcolorPlusFilterIntensity);
// (Optional) Sets the render model type, default is Render_MODE_AUTO
.setRenderModel(RenderModel.PLANE_STITCH)
// (Optional) Set the aspect ratio of the screen, default is full screen display.// If the render mode type is "RENDER_MODE_PLANE_STITCH", it is recommended to set the ratio to 2:1
.setScreenRatio(intratioX, intratioY)
// (Optional) Whether to allow gesture operations, default is true
.setGestureEnabled(booleanenabled)
// (Optional) thumbnail cache folder, default is getCacheDir () + "/ work_thumbnail "
.setCacheWorkThumbnailRootPath(Stringpath)
// (Optional) Star mode image cache folder, default is getCacheDir () + "/ cut_scene "
.setCacheCutSceneRootPath(Stringpath);WorkWrapper and playback parameters need to be set before playback.
mVideoPlayerView.prepare(workWrapper, newVideoParamsBuilder());
mVideoPlayerView.play();When the Activity is destroyed, release InstaVideoPlayerView 。
@OverrideprotectedvoidonDestroy() {
super.onDestroy();
mVideoPlayerView.destroy();
}You can control the playback progress, pause/resume, playback volume, etc. Of the video by calling the code in VideoPlayerView.
| 方法 | 参数 | 返回值 | 说明 |
|---|---|---|---|
| isPlaying | - | boolean | Is the video playing |
| isLooping | - | boolean | Whether play it on a loop |
| setLooping | boolean | void | Set whether play it on a loop |
| setVolume | float (Range 0-1) | void | Set playback volume |
| pause | - | void | Pause playback |
| resume | - | void | Resume playback |
| seekTo | long | void | Fast forward to the specified progress playback |
| isSeeking | - | boolean | Is it fast forwarding? |
| getVideoCurrentPosition | - | long | Get the current playback progress of the video |
| getVideoTotalDuration | - | long | Get the total length of the video. |
Note: If you want to switch between tiling mode and other modes, you must first restart the player.
If the rendering mode you are using is RENDER_MODE_AUTO, you can switch between the following modes.
// Switch to normal modemVideoPlayerView.switchNormalMode();
// Switch to fisheye modemVideoPlayerView.switchFisheyeMode();
// Switch to perspective modemVideoPlayerView.switchPerspectiveMode();
// To switch to tiling mode, you need to restart the playerVideoParamsBuilderbuilder = newVideoParamsBuilder();
builder.setRenderModelType(ImageParamsBuilder.RENDER_MODE_PLANE_STITCH);
builder.setScreenRatio(2, 1);
mImagePlayerView.prepare(mWorkWrapper, builder);
mImagePlayerView.play();You can customize the viewing angle and distance according to your preferences.
Fov:Angle range 0~180
Distance:line of sight range 0~∞
mVideoPlayerView.setConstraint(floatminFov, floatmaxFov, floatdefaultFov, floatminDistance, floatmaxDistance, floatdefaultDistance);You can set the PlayerViewListener to observe changes in the player state.
mVideoPlayerView.setPlayerViewListener(newPlayerViewListener() {
@OverridepublicvoidonLoadingStatusChanged(booleanisLoading) {
// Player loading status change//isLoading:whether loading
}
@OverridepublicvoidonLoadingFinish() {
// Player loading complete
}
@OverridepublicvoidonFail(interrorCode, StringerrorMsg) {
// if GPU not support, errorCode is -10003 or -10005 or -13020// Player error
}
@OverridepublicvoidonFirstFrameRender() {
// First frame rendering successfully
}
});You can set VideoStatusListener to observe changes in video status.
mVideoPlayerView.setVideoStatusListener(newVideoStatusListener() {
@OverridepublicvoidonProgressChanged(longposition, longlength) {
// Play progress callback// position:played length// length:Total length of the video
}
@OverridepublicvoidonPlayStateChanged(booleanisPlaying) {
// Video playback status callback// isPlaying:whether it is playing
}
@OverridepublicvoidonSeekComplete() {
// Fast forward completed
}
@OverridepublicvoidonCompletion() {
// Video playback finished
}
});You can set PlayerGestureListener to observe gesture actions.
mVideoPlayerView.setGestureListener(newPlayerGestureListener(){
@Overridepublic boolean onDown(MotionEvente){// User finger press eventreturnPlayerGestureListener.super.onDown(e);}
@Overridepublic boolean onTap(MotionEvente){// User finger click event, similar to View.OnClickListener.OnClick(v)returnPlayerGestureListener.super.onTap(e);}
@OverridepublicvoidonUp(){// User finger lift eventPlayerGestureListener.super.onUp();}
@OverridepublicvoidonLongPress(MotionEvente){// User long press eventPlayerGestureListener.super.onLongPress(e);}
@OverridepublicvoidonZoom(){// User two-finger zoom eventPlayerGestureListener.super.onZoom();}
@OverridepublicvoidonZoomAnimation(){// Rebound animation when scaling to maximum or minimumPlayerGestureListener.super.onZoomAnimation();}
@OverridepublicvoidonZoomAnimationEnd(){// Zoom rebound animation endsPlayerGestureListener.super.onZoomAnimationEnd();}
@OverridepublicvoidonScroll(){// User finger swipe eventPlayerGestureListener.super.onScroll();}
@OverridepublicvoidonFlingAnimation(){// Quick slide animationPlayerGestureListener.super.onFlingAnimation();}
@OverridepublicvoidonFlingAnimationEnd(){// Quick swipe animation endsPlayerGestureListener.super.onFlingAnimationEnd();}});If you want to export images, you need to first understand the ExportImageParamsBuilder image export parameters.
ExportImageParamsBuilderbuilder = newExportImageParamsBuilder()
// (Must) Export file path
.setTargetPath(Stringpath)
// (Optional) Set the width of the exported image, the default value is obtained from WorkWapper.
.setWidth(intwidth)
// (Optional) Set the height of the exported image, the default value is obtained from WorkWapper.
.setHeight(intheight)
// (Optional) Set export mode, default is'PANORAMA'// ExportMode.PANORAMA: Export panoramic images// ExportMode.SPHERE: Export flat thumbnail
.setExportMode(ExportUtils.ExportModemode)
// (Optional) Whether to enable dynamic stitching, default is true.
.setDynamicStitch(booleandynamicStitch)
// (Optional) Set the stabilization type, default is InstaStabType.STAB_TYPE_OFF.
.setStabType(@InstaStabType.StabTypeintstabType)
// (Optional) Eliminate color difference in image stitching, default is false
.setImageFusion(booleanimageFusion)
// (Optional) Remove purple fringing. Default value is false. Requires adding an algorithm file.
.setDePurpleFilterOn(booleanisDePurpleFilterOn)
// (Optional) Set the lens guards type, default is OffsetType. ORIGINAL.
.setOffsetType(OffsetTypeoffsetType)
// (Optional) Set as HDR.jpg generated by splicing, default is null
.setUrlForExport(Stringurl)
// (Optional) Set to use software decoder, default is false
.setUseSoftwareDecoder(booleanuseSoftwareDecoder)
// (Optional) Set the camera angle. It is recommended to use it when exporting thumbnails.// The currently displayed angle parameter can be obtained from'PlayerView.getXXX () '.
.setFov(floatfov)
.setDistance(floatdistance)
.setYaw(floatyaw)
.setPitch(floatpitch)
// (Optional) Cache folder, default is getCacheDir () + "/ work_thumbnail "
.setCacheWorkThumbnailRootPath(Stringpath)
// (Optional) Cache folder, default is get CacheD ir () + "/ stabilizer "
.setStabilizerCacheRootPath(Stringpath)
// (Optional) Cache folder, default is getCacheDir () + "/ cut_scene "
.setCacheCutSceneRootPath(Stringpath);Use images to export parameters:
ExportImageParamsBuilderbuilder = newExportImageParamsBuilder()
.setExportMode(ExportUtils.ExportMode.PANORAMA)
.setTargetPath(path)
.setWidth(2048)
.setHeight(1024);
intexportId = ExportUtils.exportImage(WorkWrapper, builder, newIExportCallback() {
@OverridepublicvoidonSuccess() { // Export successful
}
@OverridepublicvoidonFail() {
// Export failed
}
@OverridepublicvoidonCancel() {
// Cancel export
}
@OverridepublicvoidonProgress(floatprogress) {
// Export progress
}
});Use images to export parameters:
ExportImageParamsBuilderbuilder = newExportImageParamsBuilder()
.setExportMode(ExportUtils.ExportMode.SPHERE)
.setTargetPath(path)
.setWidth(512)
.setHeight(512)
.setFov(mImagePlayerView.getFov())
.setDistance(mImagePlayerView.getDistance())
.setYaw(mImagePlayerView.getYaw())
.setPitch(mImagePlayerView.getPitch());
intexportId = ExportUtils.exportImage(WorkWrapper, builder, newIExportCallback() {
@OverridepublicvoidonSuccess() { // Export successful
}
@OverridepublicvoidonFail() {
// Export faild
}
@OverridepublicvoidonCancel() {
// Cancel export
}
@OverridepublicvoidonProgress(floatprogress) {
// Export progress
}
});To export a video, you first need to understand the video export parameters ExportVideoParamsBuilder 。
ExportVideoParamsBuilderbuilder = newExportVideoParamsBuilder()
// (Must) Export file path
.setTargetPath(Stringpath)
// (Optional)Set the width of the exported video. It must be a power of 2, and the default value is obtained from WorkWapper.
.setWidth(intwidth)
// (Optional)Set the height of the exported video. It must be a power of 2, and the default value is obtained from WorkWapper.
.setHeight(intheight)
// (Optional)Set the bitrate for exporting videos, with the default value being obtained from WorkWapper.
.setBitrate(intbitrate)
// (Optional)Set the fps for exporting videos, with the default value being obtained from WorkWapper.
.setFps(intfps)
// (Optional) Set export mode, default is'PANORAMA'// ExportMode.PANORAMA: Export panoramic images// ExportMode.SPHERE: Export flat thumbnail
.setExportMode(ExportUtils.ExportModemode)
// (Optional) Remove purple fringing. Default value is false. Requires adding an algorithm file.
.setDePurpleFilterOn(booleanisDePurpleFilterOn)
// (Optional) Enable noise reduction (Noise reduction is enabled by default for exported images; the noise reduction toggle is only supported for exported videos)// The ExportUtils.supportDenoise(WorkWrapper) method must be called in advance to determine whether denoising is supported.// If noise reduction is supported, the setting is effective; otherwise, the setting is ineffective.
.setDenoise(true)
// (Optional) Eliminate color difference in image stitching, default is false
.setImageFusion(booleanimageFusion)
// (Optional) Set the lens guards type, default is OffsetType. ORIGINAL.
.setOffsetType(OffsetTypeoffsetType)
// (Optional) Whether to enable dynamic stitching, default is true.
.setDynamicStitch(booleandynamicStitch)
// (Optional) Set the stabilization type, default is InstaStabType.STAB_TYPE_OFF.
.setStabType(@InstaStabType.StabTypeintstabType)
// (Optional) Set to use software decoder, default is false
.setUseSoftwareDecoder(booleanuseSoftwareDecoder)
// (Optional) Cache folder, default is getCacheDir () + "/ work_thumbnail"
.setCacheWorkThumbnailRootPath(Stringpath)
// (Optional) Cache folder, default is getCacheDir () + "/ cut_scene"
.setCacheCutSceneRootPath(Stringpath)
// (Optional) Set the field of view
.setFov(floatfov)
// (Optional) Set the view distance
.setDistance(floatdistance)
// (Optional) Set the Euler angle - pitch angle
.setPitch(floatpitch)
// (Optional) Set the Euler angle-yaw angle
.setYaw(floatyaw)
// (Optional) Set the Euler angle-roll angle
.setRoll(floatroll);Use video export parameters.
ExportVideoParamsBuilderbuilder = newExportVideoParamsBuilder()
.setExportMode(ExportUtils.ExportMode.PANORAMA)
.setTargetPath(path)
.setWidth(2048)
.setHeight(1024)
.setBitrate(20 * 1024 * 1024)
.setFps(30);
intexportId = ExportUtils.exportVideo(WorkWrapper, builder, newIExportCallback() {
@OverridepublicvoidonSuccess() { // Export successful
}
@OverridepublicvoidonFail() {
// Export failed
}
@OverridepublicvoidonCancel() {
// Cancel export
}
@OverridepublicvoidonProgress(floatprogress) {
// Export progress
}
});Since the exported result is an image, use the image export parameters.
ExportImageParamsBuilderbuilder = newExportImageParamsBuilder()
.setExportMode(ExportUtils.ExportMode.SPHERE)
.setTargetPath(path)
.setWidth(512)
.setHeight(512)
.setFov(mVideoPlayerView.getFov())
.setDistance(mVideoPlayerView.getDistance())
.setYaw(mVideoPlayerView.getYaw())
.setPitch(mVideoPlayerView.getPitch());
intexportId = ExportUtils.exportVideoToImage(WorkWrapper, builder, newIExportCallback() {
@OverridepublicvoidonSuccess() { // Export successful
}
@OverridepublicvoidonFail() {
// Export failed
}
@OverridepublicvoidonCancel() {
// Cancel export
}
@OverridepublicvoidonProgress(floatprogress) {
// export progress
}
});ExportUtils.stopExport(exportId);If you have a WorkWrapper with HDR images, you can generate them into an image file using HDR stitching.
Note: This is a time-consuming operation that needs to be handled in a child thread.
booleanisSuccessful = StitchUtils.generateHDR(WorkWrapperworkWrapper, StringhdrOutputPath);After the successful call of generateHDR, outputPath can be played as a proxy or set as an export URL.
// Set as playback agentImageParamsBuilderbuilder = newImageParamsBuilder()
// If HDR splicing is successful, set it as a playback proxy
.setUrlForPlay(isSuccessful ? hdrOutputPath : null);
mImagePlayerView.prepare(workWrapper, builder);
mImagePlayerView.play();
// Set as export urlExportImageParamsBuilderbuilder = newExportImageParamsBuilder()
.setExportMode(ExportUtils.ExportMode.PANORAMA)
.setTargetPath(exportPath)
// If HDR splicing is successful, set it as export url
.setUrlForExport(hdrOutputPath);If you have a WorkWrapper of a PureShot image, you can generate it into an image file by stitching it together with PureShot.
Note: This is a time-consuming operation that needs to be handled in a child thread.
booleanisSuccessful = StitchUtils.generatePureShot(WorkWrapperworkWrapper, StringpureshotOutputPath, StringalgoFolderPath);Note: Generating PureShot images requires algorithm model files. Please request the algorithm model files corresponding to your SDK version from our technical support team.
algoFolderPath is the directory for algorithm model files, which can be either LocalStoragePath or AssetsRelativePath. The SDK will load these files as needed.
After the successful call to generatePureShot, outputPath can be played as a proxy or set as an export URL.
// Set as playback agentImageParamsBuilderbuilder = newImageParamsBuilder()
// If PureShot splicing is successful, set it as a playback proxy
.setUrlForPlay(isSuccessful ? pureshotOutputPath : null);
mImagePlayerView.prepare(workWrapper, builder);
mImagePlayerView.play();
// Set as export urlExportImageParamsBuilderbuilder = newExportImageParamsBuilder()
.setExportMode(ExportUtils.ExportMode.PANORAMA)
.setTargetPath(exportPath)
// If PureShot splicing is successful, set it as the export url
.setUrlForExport(pureshotOutputPath);Certain functions require algorithm files. These files can be found in the assets folder within the demo directory. Ensure the file paths match those in the demo.
Below is a table mapping function of their corresponding required algorithms:
| Function | Model File | Path Description |
|---|---|---|
| Defringe | defringe_lr_dynamic_e28c1212.ins defringe_hr_dynamic_7b56e80f.ins | DFixed path: file:///android_assets/insta360/model/ |
| Color Plus | lut_7a79b17a_32.ins | Fixed path: file:///android_assets/insta360/model/ |
| PureShot Generation | Pmdenoise_raw_plus.insraw_denoising_abeda57d.ins283fish.ilp283wide.ilp577.ilp586.ilpX3.ilp | Developer custom path:Passed in by the StitchUtils.generatePureShot function |
| Error code | Explanation |
|---|---|
| -31000 | Exporting in progress |
| -31010 | Stop exporting |
| -31011 | Failed to load stabilization data |
| -31012 | EXPORT_TERMINATED_BY_WORK_REFERENCE_RELEASABLE |
| -31016 | EXPORT_POST_EXECUTE_FAILED |
| -31017 | Original thumbnail LRV not found |
| -31018 | Original thumbnail LRV loading failed |
| -31019 | EXPORT_VIDEO_TO_IMAGE_SEQUENCE_CANCEL |
| -13016 | Export timeout |
| -13017 | Cancel export |
| -13018 | SHADOW_EXPORT_INIT_SHADOW_CLONE_FAIL |
| -13019 | SHADOW_EXPORT_PREPARE_EXPORT_INFO_FAIL |
| -13021 | Failed to enable hardware encoding |
| -13022 | SHADOW_EXPORT_FAIL_TARGET_TIME_NULL |
| -13023 | SHADOW_EXPORT_PREPRARE_FRAME_EXPORTER_FAIL |
| -13024 | SHADOW_EXPORT_INPUT_TARGET_FAIL |
| -13025 | STOP_MOTION_SELECT_POSE_CLIP_NULL |
| -13026 | STOP_MOTION_SELECT_CLIP_NOT_MATCH |
| -13027 | STOP_MOTION_SELECT_LOAD_STABILIZER_FAIL |
| -13028 | STOP_MOTION_SELECT_KEY_NULL |
| -13029 | SHADOW_EXPORT_TRACK_TARGET_EMPTY |
| -13031 | Frame exporter preparation failed |
| -13033 | Reverse video parsing failed |
| -13034 | Dual stream frame format is different |
| -13035 | Thumbnail Stabilization Error |
| -13036 | Video frame rate equals 0 |
| -13038 | Video width equals zero |
| -13039 | Video height equals zero |
| -13040 | The denoise model equals null. |
| -13041 | Video source frame rate equals 0 |
| -13042 | Video source duration equals 0 |
| -13043 | Image Denoise File Transfer Error |
| -13034 | Dual stream frame format is different |
| -13044 | Failed to load AAA parameters |
| -13045 | Failed to create denoise data |
| -13046 | Image width equals 0 |
| -13047 | Image height equals 0 |
This typically refers to establishing a connection with the camera via Wi-Fi. The app communicates with the camera through two methods: socket and HTTP. Below are the corresponding functions for each communication method:
- Socket:Preview stream, read camera parameters, set camera parameters, read capture parameters, set capture parameters, etc. // TODO Supported features to be completed
- Http Initialize the supported list, download camera files. // TODO Supported features to be completed
The root cause of this issue stems from calling
ConnectivityManager#bindProcessToNetwork(network)when establishing a socket connection with the camera, which binds the current process to the camera's Wi-Fi network.Therefore, after establishing a Wi-Fi connection, calling
ConnectivityManager#bindProcessToNetwork(4GNetwork)to bind to an available network (such as 4G) resolves the inability to access the internet. Since the socket connection is already established, unbinding still allows continued use of socket-enabled features.However, this approach introduces a problem. Because the current process is no longer bound to the camera's Wi-Fi, using features dependent on HTTP communication will result in the following error:
There are two solutions to this problem:
- When using features related to HTTP communication, call the
bindProcessToNetwork(camera)method to bind to the camera's Wi-Fi. Upon completing the relevant functionality, callbindProcessToNetwork(4g)to switch back to the available 4G network.
- Pros: Simple implementation
- Cons: Will temporarily disconnect from the Internet.
- Launch a new process named download. Call the bindProcessToNetwork(camera) method to bind the download process to the camera's Wi-Fi network. All HTTP communication-related functions are executed within the download process.
- Pros: Perfectly solves the problem of being unable to access the Internet.
- Cons: Complex implementation
H.264 format, containing both PPS and SPS frame data.
Upgrade to version 1.8.1_build_05 or later
implementation("com.github.jeasonlzy.okhttp-OkGo:okgo:v3.0.4")
implementation("com.arashivision.sdk:sdkcamera:1.8.0_build_11"){
exclude("com.github.jeasonlzy","okhttp-OkGo")
}
Socket read failure typically occurs when Wi-Fi is disabled by the system. Manually reconnecting to Wi-Fi via the system settings page can reduce the likelihood of automatic disconnection by the system.
The photo width is 16386 pixels, exceeding the 8192-pixel rendering limit on some Huawei phones.
Q7: What should I do if my Google Play Store submission is rejected after integrating the SDK because the .so file is not aligned to 16K?
Download version 1.8.2-build4 from the Maven repository.
Then, exclude the following libraries from your package (this won't affect SDK functionality), and then submit to the Google Play Store:
libSnpeHtpV68Skel.so (AI acceleration-related auxiliary components)
libSnpeHtpV69Skel.so (AI acceleration-related auxiliary components)
libSnpeHtpV73Skel.so (AI acceleration-related auxiliary components)
iibSnpeHtpV75Skel.so (AI acceleration-related auxiliary components)
libSnpeHtpV7.9Skel.so (AI acceleration-related auxiliary components)
libcalculator_skel.so (AI acceleration-related auxiliary components)
x86_64/libmobvoidsp.so (X86 library; selecting X64 in the package will prevent it from being included)
