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