I downloaded mipsdkmobile-web and was able to view live video using the VideoStream sample.
So in preparation of incorporating a video viewer into the application, I examined the sample code to work out to what it and the associated libraries were actually doing. I wrote a small HTML document with hardcoded server and camera ID (same as used with the VideoStream sample) to make sure it would work. It does not, and I cannot figure out why.
When it runs, I see a frozen image from the camera briefly, then it disappears, then the frozen image reappears, then it takes the fallback clause. The fallback is called with the message, “Falling back because the video player has been restarted more than : 1 time(s) for a specific time.”
I am hoping someone can point out what I’m doing wrong. Here is my page:
<!doctype html>
<html>
<head>
<script src="milestone/mipsdkmobile-web/XPMobileSDK.js"></script>
<script src="milestone/mipsdkmobile-web/Lib/modules/VideoStream/main.js" type="module"></script>
<script src="milestone/mipsdkmobile-web/Lib/modules/VideoConnection/main.js" type="module"></script>
<script>
const server = 'https://milestonedos.cdmx.hitech.com:8082';
const user = 'safety';
const password = '%EU3mAP!';
const camera = '131ca53e-3791-4379-8b03-e78d4c2894fc';
XPMobileSDK.onLoad = function() {
XPMobileSDKSettings.MobileServerURL = server;
XPMobileSDK.addObserver({
connectionDidConnect: () => {
console.log('Connected!', arguments);
request = XPMobileSDK.login(user, password, 'Basic', {});
console.log(request);
},
connectionDidLogIn: () => {
console.log('Logged in!', arguments);
let videoElement = document.createElement('videos-stream');
videoElement.cameraId = camera
videoElement.name = 'The camera'
document.body.appendChild(videoElement);
videoElement.dispatchEvent(new CustomEvent('start'));
videoElement.addEventListener('fallback', (event) => {
console.error('video failed', event);
})
}
})
let request = XPMobileSDK.connect(server);
console.log(request);
}
</script>
<style>
videos-stream::part(video-player) {
max-width: 670px;
max-height: 380px;
}
</style>
</head>
<body>
</body>
</html>