Getting error while trigging video stream

We are developing a video streaming api using the websdk below is the code , when the video stream component is appended upon start custome event getting this error, can you please help guide the mistake we are doing.. This is coming everytime we try to get the live camera feed

Error executing GetAllViewsAndCameras on the server.

Response error NotAllowedInThisState 23 Complete response: <?xml version="1.0" encoding="utf-8"?>ResponseGetAllViewsAndCamerasError23

if (isLogged) {

XPMobileSDK.getAllViews(function (items) {

if (items) {

for (var i = 0; i < items[0].Items[0].Items[0].Items.length; i++) {

let videoMonitor = document.getElementById(‘NEB-VIDEO-WALL-1’);

let videoElement = document.createElement(‘videos-stream’);

videoElement.cameraId = items[0].Items[0].Items[0].Items[i].Id;

videoElement.name = items[0].Items[0].Items[0].Items[i].Name;

videoElement.setAttribute(‘cameraId’,items[0].Items[0].Items[0].Items[i].Id);

videoElement.setAttribute(‘name’, items[0].Items[0].Items[0].Items[i].Name);

videoElement.setAttribute(‘id’, videoElement.cameraId);

videoElement.setAttribute(‘class’, ‘shadow bordered col-10’);

videoMonitor.appendChild(videoElement);

videoElement.dispatchEvent(new CustomEvent(‘start’));

videoElement.addEventListener(‘fallback’, (event) => {

let player = event.target.shadow.lastElementChild.getElementsByClassName(‘player’)[0];

let errorMsg = document.createElement(‘div’);

errorMsg.innerHTML = “Could not start direct streaming.”;

player && player.parentNode.appendChild(errorMsg);

player && player.parentNode.removeChild(player);

errorMsg = null;

player = null;

});

}

}

});

}

else {

var lastObserver = {

connectionFailedToLogIn: function () {

alert(‘could not connect to server’);

},

connectionDidConnect: function () {

XPMobileSDK.login(usern, pass, authtype, {

SupportsAudioIn: ‘Yes’,

SupportsAudioOut: ‘Yes’

});

isLogged = true;

},

connectionDidLogIn: function () {

if (!XPMobileSDK.library.Connection.directStreamingServer) {

alert(‘Your server does not support Live Direct Streaming!’);

} else {

XPMobileSDK.getAllViews(function (items) {

if (items) {

for (var i = 0; i < items[0].Items[0].Items[0].Items.length; i++) {

let videoMonitor = document.getElementById(‘NEB-VIDEO-WALL-1’);

let videoElement = document.createElement(‘videos-stream’);

videoElement.cameraId = items[0].Items[0].Items[0].Items[i].Id;

videoElement.name = items[0].Items[0].Items[0].Items[i].Name;

videoElement.setAttribute(‘cameraId’,items[0].Items[0].Items[0].Items[i].Id);

videoElement.setAttribute(‘name’, items[0].Items[0].Items[0].Items[i].Name);

videoElement.setAttribute(‘id’, videoElement.cameraId);

videoElement.setAttribute(‘class’, ‘shadow bordered col-10’);

videoMonitor.appendChild(videoElement);

videoElement.dispatchEvent(new CustomEvent(‘start’));

videoElement.addEventListener(‘fallback’, (event) => {

let player = event.target.shadow.lastElementChild.getElementsByClassName(‘player’)[0];

let errorMsg = document.createElement(‘div’);

errorMsg.innerHTML = “Could not start direct streaming.”;

player && player.parentNode.appendChild(errorMsg);

player && player.parentNode.removeChild(player);

errorMsg = null;

player = null;

});

}

}

});

}

}

};

XPMobileSDK.addObserver(lastObserver);

XPMobileSDK.connect(sdkurl);

}

We are integrating video stream in our application by using web sdk of milestone , and by refering to the videostreams sample application. Though component is created the video control is not getting created.

Hey,

Are those two problems?

  • GetAllViewsAndCameras
  • video control is not getting created.

The first one 23 most probably means you are not logged in succesfully . Have you logged in first ?