Video Push issues with Mobile 2018R2 Web SDK

We’re having an issue with the Mobile 2018R2 Web SDK and video push. Should the sample.html and sample.js (with relevant section uncommented) be working out of the box?

We have no issues displaying the cameras or using other functionality, or using video push from the android/ios apps, but this is an unexpected obstacle.

Our issues appear to be on send(), where we receive an error in the fromGuid function where the guid (f.videoId) is undefined. The interesting part is if we inspect the object, there is a VideoID string present but not videoId (casing) and then no StreamId as referenced by the next lines which build the ajax request. The videoId/VideoId discrepancy may be telling.

Following a similar issue and example from a previous post https://developer.milestonesys.com/s/question/0D50O00003GXtk7SAD/mobile-server-video-push-questions?t=1533306076375, video push works perfectly with the sample provided in the comments. (using the same server and credentials). Unfortunately, that example does not use the compiled library.

This prompts my question about the sample. I have sunk some time into trying to find the problem with an unminified version of the compiled XPMobileSDK.library.js, but without a whole lot of luck. Would it be possible for someone to verify for us that the 2018R2 samples are working for them?

Thanks for the help!

Well done, Colin, Well done !

You are completely right - the provided sample doesn’t work when relevant section is un-commented.

And you correctly described the reason “VideoId” and “StreamId” parameters are missing. Instead “videoId” should be used.

Changes that have to be made in the SDK (in particular videoPushConnection.js) are:

function close() {

if (!isOpen()) return;

if (streamRequest) {

XPMobileSDK.cancelRequest(streamRequest);

streamRequest = null;

}

if (stream) {

XPMobileSDK.closeStream(stream.videoId);

stream = null;

}

}

function send(base64EncodedImage) {

var bytesArray = XPMobileSDK.library.Bytes.fromBase64(base64EncodedImage);

var buffer = new ArrayBuffer(headerSize + bytesArray.length);

var bufferView = new Uint8Array(buffer);

// Header

bufferView.set(XPMobileSDK.library.Bytes.fromGuid(stream.videoId, 16)); // Video id

bufferView.set(XPMobileSDK.library.Bytes.fromInt(new Date().getTime(), 8), 16); // Timestamp

bufferView.set(XPMobileSDK.library.Bytes.fromInt(++counter, 4), 24); // Frame count

bufferView.set(XPMobileSDK.library.Bytes.fromInt(bytesArray.length, 4), 28); // Frame size in bytes

bufferView.set(XPMobileSDK.library.Bytes.fromInt(headerSize, 2), 32); // Header size in bytes

bufferView.set(XPMobileSDK.library.Bytes.fromInt(0, 2), 34); // Header extension flags

// Data

bufferView.set(bytesArray, headerSize);

var url = XPMobileSDKSettings.MobileServerURL + XPMobileSDKSettings.videoChanel + ‘/’ + stream.videoId + ‘/’;

var parameters = {

method: ‘post’,

contentType: ‘arraybuffer’,

postBody: buffer,

onLoading: onAjaxLoading,

onSuccess: onAjaxSuccess,

onFailure: onAjaxFailure

};

var ajaxRequest = new XPMobileSDK.library.Ajax.Request(url, parameters);

}

function onAjaxFailure(request) {

console.log('ERROR in ajax request for video push with videoId ’ + stream.videoId);

}

I’ll fix the SDK for the next release and will create User Story for creation of dedicated Video Push sample.

Thanks Petar! We’ll use your pointers to adapt the existing sdk in the meantime. Is there a target ETA for the Q3 release?

As far as I know there is still no concrete date, but it should be in the beginning of October.