Android Mobile SDK Playback Sample Callbacks / Timeline / Features

We are currently developing a custom player interface for the mobile server. We are using the example code from your sample. on android MilestoneMobileSDKPlaybackSample.

However, it is very limited in its capabilities. The only functions exposed are basically play/pause, PlayForward, PlayBackward. Which is fine. However, we need to visualize a timeline for the duration of the video we are trying to play. We have the duration, but there is no callback or anything to allow us to move the player to a position,etc.

Do you have any examples or sample or suggestions for the best way to add some additional playback functionality? We are looking to do this on IOS as well.

Hello,

For this type of more advanced functionality, it’s better not to rely on the Playback object (which is high-level and with rather limited functionality, as you have noticed), but to use directly the connection maintained by the xpMobileSDK object,

E.g. for displaying a timeline, you could use the getSequences(…) command.

It will return list will all the sequences from a given type (e.g. motion, recording etc) for a given camera in the specified time interval.

To seek the video to a specific time, you could use the seekVideo(..) command, etc.

Hope this helps,

Plamen Parvanov

Plamen,

we are having issue with the android sdk sample provided. When we select a camera with a valid sequence, it will ONLY play backwards. Once we play it backwards, it will then play forward. Can you please advise some details on excactly how the player control should work, and/or provide a working player example for android? We have reviewed and tested the provided sample and reviewed the documentation. Please advise asap.

Thanks!

is there a way to select to play from the beginning of the sequence and not the end?

so we confirmed that the android sdk opens at the end of the sequence, so playforward is not working. can you advise how we can have it open at the beginning of the sequence or we can go back to the beginning of the sequence?

Hello,

You are correct, the Android Mobile SDK Playback sample will start the playback positioned at the current time (or the time closest to it which has recordings). So unless the camera is not currently recording, it’ll be at the end of the last sequence and it will not be possible to play forward (as there are no more recordings).

There is currently no way to change this behavior if using the Playback object, which has a limited functionality.
In this case it’s better to work directly with the connection maintained by the XPMobileSDK object.

Then you could use getSequences( … ) command to get detailed information about all sequences, and seekVideo( … ) command to position the playback in the beginning of a sequence.

Hope this helps,
Plamen Parvanov

Plamen,

can you please provide more specific info ok the best way to go about this? Are there any examples we can review?

Since we are using the android sdk it provides for playback, view etc. Do you have some example code or something that shows how to this outside of that specifically.

Hello,

Unfortunately there is currently no dedicated sample for this functionality.
I’ll try to provide some code snippets to show it works

Best regards,
Plamen Parvanov

That would be great thank you.

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/

Plamen,

We are using the javascript command api to get sequences , and once we select a sequence, how do we play it back? If we use the sdk as you stated above, it will play from the end. Do we need to implement our own jpeg player?

Hello,

There is no need to implement your own jpeg player.
Once you get the sequences, you’ll know the start time for a given sequence. You can then seek (move the playback time) to this time, and start playback from there.
If you use Javascript SDK and its playback video object, you can use:
- GoToTime or GoToDbPosition for seek
- ChangePlaybackSpeed (with speed = 1) for starting playback from the current seek position

Best regards,
Plamen Parvanov

Can you please provide some code samples showing the whole process?

Is there any update to the functionality of the playback sample? It seems even in 2021R1 MIP Mobile SDK this is still an issue. Can you advise how we can play from the beginning of a selected sequence? Its very confusing for users.

Hi Josh,

You are correct, the playback sample has not been updated for this release.
We haven’t forgotten about it (and the change request is in our backlog) but, unfortunately, we weren’t able to implement it this time.

On how to play from the beginning of a selected sequence – my previous reply (with the code sample) is still valid:

1. Extend PlaybackVideo to add sequences and seek functionality
2. Use MyPlaybackVideo in place of PlaybackVideo (in PlaybackActivity.kt)
Hope this helps.

Best regards,
Plamen Parvanov

From: Milestone Developer Forum <noreply@milestonesys.com>
Reply to: Reply to Developer Forum <154n8hj2f9vbhrk8.ojc1bprw3lhh5fdi.387ddb1sfb3fx5gy@kcm9g0fvt06wspac.lftx7zmr3yutkx.2-8uideae.eu29.chatter.salesforce.com>

Hi, is there any update on getting playback samples for IOS and Android that work properly.

Hello,

Unfortunately, there is no news at this time.

Best regards,
Plamen Parvanov