Skip to main content
13-Aquamarine
May 10, 2022
Solved

Custom widget working on my local Thingworx, not on the production server

  • May 10, 2022
  • 2 replies
  • 3695 views

Hello,

 

I created a custom widget in order to integrate the OvenMedia WebRTC player (https://airensoft.gitbook.io/ovenplayer/). I included the Third part javascript and the player is starting on my local computer but not in the production environment. What could be the problem & how can I analyze this?

 

Development environment: Thingworx 9.1.0-b10877

Production environment: Thinworx 9.2.5-b308

 

The code to import the ovenmedia js and start the player is the following one:

this.renderHtml = function () {
$("body").append('<script type="text/javascript" src="../Common/extensions/OvenPlayer/ui/OvenPlayer/include/ovenplayer.js"></script>');


var html = '<div class="player-wrapper"><div id="player_id"></div><div id="player_label">TEST</div></div>';

return html;
};

this.afterRender = function () {
document.getElementById("player_label").innerHTML = "DEBUG1.3";
OvenPlayer.debug(true);
document.getElementById("player_label").innerHTML = OvenPlayer.getPlayerList().length;
var player = OvenPlayer.create('player_id', {
sources: [
{
label: 'label_for_webrtc',
// Set the type to 'webrtc'
type: 'webrtc',
// Set the file to WebRTC Signaling URL with OvenMediaEngine
file: 'ws://10.10.10.10:3334/mystream/arm' //updatePropertyInfo.StreamURL
}
]
});
document.getElementById("player_label").innerHTML = player;

player.play();
document.getElementById("player_label").innerHTML =OvenPlayer.getPlayerList();

};

Best answer by nmutter

Yes, I also don't see that it should behave differently on windows.

 

Hm, on the spot I also don't have any direct idea. What I would try:

  1. Check the js-console for errors
  2. Don't attach the .js file via document.appen but just include it in the metadata.xml with isRuntime="true" (should resolve any path issues)
  3. Still check if in the DeveloperConsole the "OvenPlayer.js" file can be seen in the Network tab to be downloaded with status code 200
  4. Check if you see the OvenPlayer-object via the DeveloperConsole (via the console tab and just try to execute something like OvenPlayer.debug(true);)
  5. Debug your JS via DeveloperConsole and step through line by line..
  6. DoubleCheck that the same extension is deployed on DEV and PROD

 

I think the only issue can be that this ovenplayer.js file is not loaded correctly from what we can see.

2 replies

16-Pearl
May 11, 2022

@gch 

 

Do you have the same custom extensions and widgets imported on both dev and prod servers? We have seen in the past that sometimes due to custom extensions, widgets don't work as expected. 

gch13-AquamarineAuthor
13-Aquamarine
May 11, 2022

It was not the case but I imported the missing extensions on dev and it is still the case. It seems that the Third part js is not loaded at all on prod.

gch13-AquamarineAuthor
13-Aquamarine
May 13, 2022

Any other idea on How to debug this?

16-Pearl
May 17, 2022

I would check in the developer console (F12) in the network tab if the overplayer.js is being loaded correctly. I assume the path may not be correct so it will result in a 404 error? Is the OS different from DEV to PROD as it may handle caseSensitiveness different for the path?

gch13-AquamarineAuthor
13-Aquamarine
May 19, 2022

Hi,

 

we can see on the screenshot attached at the top that overplayer.js seems not to be loaded. I tried several path without success but I'm wondering that this is working well on my computer.

There is a 404 error on both systems, prod and dev, but this is related to the file ovenplayer.js.map that is not necessary. There is no 404 error related to the file ovenplayer.js.

The OS are Windows 10  and if I remember well Windows 12, so the behavior should be similar?