Insta360Develop / CameraSDK-Android

Android SDK to control Insta360 cameras
81 stars 9 forks source link

Setting camera's date-time #15

Open scana opened 2 years ago

scana commented 2 years ago

Hello! Is there any way to set camera's date time via SDK? I couldn't find anything in InstaCameraManager. We used to do this via OSC, but it seems that video recordings started with the SDK ignore that setting.

FYI: @EternalSoySauce

EternalSoySauce commented 2 years ago

When connects to the camera, sdk automatically synchronizes the time to the camera.

scana commented 2 years ago

@EternalSoySauce thanks! Let me describe an issue that we have so maybe the need for setting it manually it would be more clear.

We operate with UTC time and the files stored on the camera are named with a local timestamp, without timezone information. This oftentimes causes issues that by just looking at the filename, we can't say what was the actual time a video was created - are there any EXIF information that we could use to get a timestamp in UTC?

EternalSoySauce commented 2 years ago

The timestamp and timezone synchronized to the camera are obtained from the mobile phone system. timestamp = System.currentTimeMillis() timezone = TimeZone.getDefault() But the file itself does not have information related to the timezone.

scana commented 2 years ago

Hey @EternalSoySauce - any chance if you could point me to a specific class where synchronisation is made? We've noticed that with GMT+2 Android SDK will set different time that iOS SDK.

scana commented 2 years ago

@EternalSoySauce scratch that last question.

I have just discovered that Android SDK does not account for DST:

Options options = new Options();
options.setLocalTime(time);
options.setTimezoneSecodeFromGMT(timeZone.getRawOffset() / 1000);
mInstaCamera.setOptionAsync(options);

and this is why there is a difference in file names when recording files with Android SDK and iOS SDK.

getRawOffset will return a raw offset, without a DST correction.