Hello,
Here is a sample code to show how to access sequences and seek video in MilestonMobileSDKPlaybackSample for Android:
1. Extend PlaybackVideo to add sequences and seek functionality:
public class MyPlaybackVideo extends PlaybackVideo {
private String cameraId;
public MyPlaybackVideo(XPMobileSDK connection, VideoReceiver receiver, HashMap<String, Object> requestParams) {
super(connection, receiver, requestParams);
// store camera ID (needed by getSequences()
cameraId = (String)requestParams.get("CameraId");
}
/** Go to specific time
\* @param timestamp - time in ms since unix epoch
\*/
public void gotoTime( long timestamp ) {
connection.seekVideo( videoId, "Time", String.valueOf(timestamp) , null, null );
}
/**
Get all sequences (recordins) for the current camera
Warning: this might be inefficient for a camera with a lot of recordings
\*/
public List getSequences() {
return connection.getSequences( cameraId, "recording",
0, 0, null, null ).getRecordings();
}
}
2. Use MyPlaybackVideo in place of PlaybackVideo:
(in PlaybackActivity.kt)
private var playbackVideo:MyPlaybackVideo? = null
onCreate(… ){
…
// playbackVideo = applicationObject?.xpMobileSDK?.requestPlaybackVideo(this,allProperties)
playbackVideo = MyPlaybackVideo( applicationObject?.xpMobileSDK, this, allProperties )
playbackVideo?.requestVideo()
…
e.g. to go to the beginning of the first sequence:
Thread(Runnable {
val seqs = playbackVideo?.getSequences()
if( seqs?.size!! > 0 ){
playbackVideo?.gotoTime(seqs\[0\].startTimeStamp)
}
}).start()
You can read more about the GetSequences and ChangeStream commands (used by seekVideo) in the Mobile Server protocol documentation: https://doc.developer.milestonesys.com/mipsdkmobile/