cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

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

gch
13-Aquamarine
13-Aquamarine

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

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();

};

ACCEPTED SOLUTION

Accepted Solutions
nmutter
16-Pearl
(To:gch)

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.

View solution in original post

7 REPLIES 7

@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. 

gch
13-Aquamarine
13-Aquamarine
(To:SachinSharma)

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.

gch
13-Aquamarine
13-Aquamarine
(To:gch)

Any other idea on How to debug this?

nmutter
16-Pearl
(To:gch)

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?

gch
13-Aquamarine
13-Aquamarine
(To:nmutter)

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? 

nmutter
16-Pearl
(To:gch)

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.

gch
13-Aquamarine
13-Aquamarine
(To:nmutter)

Hi,

 

1. the js-console doesn't show anything

2. This is it, importing it in the meta data works also on prod!

 

Thank you for your help!

Announcements


Top Tags