Unable to retrieve playback using Mobile SDK libraries

Hi all,

I have referred to PTZSample application (part of mobile SDK) and tried to implement the playback. I am only able to get first frame upon requeststream in playback mode. No blob related data is received from the next frames.

Please find my implementation below.

var lastObserver;
var videoController;
var streamRequest = XPMobileSDK.RequestStream(RequestStreamParamsPlayBack(cameraID, 'Playback'), requestStreamCallback, function (error) {
    console.log(error);
    console.log("error streaming the request");
});
 
function requestStreamCallback(videoConnection) {
    videoController = videoConnection;
    videoController.cameraId = cameraID;
    videoConnection.addObserver(videoConnectionObserver);
    videoConnection.open();
}
 
 
 
function RequestStreamParamsPlayBack(cameraID, signalType) {
    return {
        //ConnectionId: XPMobileSDK.library.Connection.connectionId,
        CameraId: cameraID,
        DestWidth: 400,
        DestHeight: 300,
        SignalType: signalType /*'Live' or 'Playback'*/,
        MethodType: 'Push' /*'Pull'*/,
        Fps: 25, // This doesn't work for Pull mode, but we have to supply it anyway to keep the server happy
        ComprLevel: 10,
        KeyFramesOnly: 'No' /*'Yes'*/, // Server will give only key frame thumb nails. This will reduce FPS
        RequestSize: 'Yes',
        StreamType: 'Transcoded',
        SeekType: 'Time',
        Time: '1551162958000',
        // TimeRestrictionStart:'1551162958000',
        // TimeRestrictionEnd : '1551163158000',		
    };
}
 
function videoConnectionReceivedFrame(frame) {
 
    if (frame.dataSize > 0) {
 
        if (frame.hasSizeInformation) {
            var multiplier = (frame.sizeInfo.destinationSize.resampling * XPMobileSDK.getResamplingFactor()) || 1;
            imageElement.width = multiplier * frame.sizeInfo.destinationSize.width;
            imageElement.height = multiplier * frame.sizeInfo.destinationSize.height;
        }
 
        if (imageURL) {
            urlObject.revokeObjectURL(imageURL);
        }
 
        imageURL = urlObject.createObjectURL(frame.blob);
 
        imageElement.src = imageURL;
 
        // if (!isLive && frame.timestamp.getTime() != playbackTimestamp.getTime())
        // {
        //      updateTime(frame.timestamp);
        // }
    }
}
 

Thanks for the help

Vamshi

Hi Vamshi,

please refer to the Video sample.

There is shown how to start live and playback streams.

By default, when you start playback stream it is in “paused” state.

(Therefore you receive only one frame)

So you have to change it’s speed:

XPMobileSDK.playbackSpeed()

Also you could perform seek (start and end of DB for example):

XPMobileSDK.playbackSeek()

Or go to specific time of the playback:

XPMObileSDK.playbackGoTo()

Changing the speed of the playback is well demonstrated in the Video Sample (playing forward with speed 1, backward with speed -1 and stop of the playback).

All the commands are well commented in the XPMobileSDK.js. You can use it for reference.