Play HTML page on localhost, WebGL error

Hello,

I am newbie in CAsparCG .
I try to play a map html page in casparcg. My command:

play 1-61 [HTML] "file:///C:/img/map.html"

Caspar cg gives error:

Failed to initialize WebGL.
[2024-11-02 16:54:30.596] [info]    Received message from Console: play 1-61 [HTML] "file:///C:/img/map.html"\r\n
#202 PLAY OK

I installed google Chrome and checked Webgl:

Config:

 -----------------------------------------
[2024-11-02 16:55:37.699] [info]    <?xml version="1.0" encoding="utf-8"?>
[2024-11-02 16:55:37.699] [info]    <configuration>
[2024-11-02 16:55:37.699] [info]       <paths>
[2024-11-02 16:55:37.699] [info]          <media-path>media/</media-path>
[2024-11-02 16:55:37.699] [info]          <log-path disable="false">log/</log-path>
[2024-11-02 16:55:37.699] [info]          <data-path>data/</data-path>
[2024-11-02 16:55:37.699] [info]          <template-path>template/</template-path>
[2024-11-02 16:55:37.699] [info]       </paths>
[2024-11-02 16:55:37.699] [info]       <lock-clear-phrase>secret</lock-clear-phrase>
[2024-11-02 16:55:37.699] [info]       <channels>
[2024-11-02 16:55:37.699] [info]          <channel>
[2024-11-02 16:55:37.699] [info]             <video-mode>1080i5000</video-mode>
[2024-11-02 16:55:37.699] [info]             <consumers>
[2024-11-02 16:55:37.699] [info]                <screen/>
[2024-11-02 16:55:37.699] [info]                <system-audio/>
[2024-11-02 16:55:37.699] [info]             </consumers>
[2024-11-02 16:55:37.699] [info]          </channel>
[2024-11-02 16:55:37.699] [info]       </channels>
[2024-11-02 16:55:37.699] [info]       <controllers>
[2024-11-02 16:55:37.699] [info]          <tcp>
[2024-11-02 16:55:37.699] [info]             <port>5250</port>
[2024-11-02 16:55:37.699] [info]             <protocol>AMCP</protocol>
[2024-11-02 16:55:37.699] [info]          </tcp>
[2024-11-02 16:55:37.699] [info]       </controllers>
[2024-11-02 16:55:37.699] [info]       <amcp>
[2024-11-02 16:55:37.699] [info]          <media-server>
[2024-11-02 16:55:37.699] [info]             <host>localhost</host>
[2024-11-02 16:55:37.699] [info]             <port>8000</port>
[2024-11-02 16:55:37.699] [info]          </media-server>
[2024-11-02 16:55:37.699] [info]       </amcp>
[2024-11-02 16:55:37.699] [info]    </configuration>
[2024-11-02 16:55:37.699] [info]    <html>
[2024-11-02 16:55:37.699] [info]       <enable-gpu>true</enable-gpu>
[2024-11-02 16:55:37.699] [info]    </html>

How can i solve this problem ?

What version of CasparCG do you use? It does not help to install Chrome to check, if WebGL is supported, you need to know, if it’s supported inside Caspars embedded Chromium browser.

1 Like

Here are two websites that perform some tests on the WebGL capability of any browser - https://get.webgl.org and https://webglreport.com. The latter test reports version 1 properties by default. To show V2 properties in CasparCG add /?v=2 to the end of the command line.

I can see you have enabled the gpu, which I think is a requirement for WebGL in Caspar. I tested CasparCG server 2.4.0, which reported WebGL was disabled or unavailable. When I enabled GPU and re-tested the WebGL reported working and supported.

1 Like

Thank you for answer.
Casparcg version 2.4.1.
how to check chromium supports?

Thnak you for reply.

I tested webgl .it works .

i tried command like that but id didnt work.

play 1-61 [HTML] "file:///C:/img/map.html"/?v=2```

I tried this command and gives play ok but didnt show

play 1 [HTML] "file:///C:/img/map.html/?v=2"
[2024-11-02 21:50:45.349] [info]    Received message from Console: play 1 [HTML] "file:///C:/img/map.html/?v=2"\r\n
#202 PLAY OK

The ?v=1 and ?v=2 ONLY apply to test website webglreport.com. So the two forms of command to that test site are:
https://webglreport.com/?=1
https://webglreport.com/?=2

1 Like

I had problems loading local textures in webgl templates.
Did you try playing a web version of that map?
You can run a local webserver: node.js, nginx.

1 Like

i tried v1 and v2 . it supports.

Normally I can play tomtom maps on Chrome or Edge browser without server.

In a conventional browser you can access the debug tools, including console log error reports, using a right click. The same inspection tools can be accessed for an html page or template running in CasparCG server, although the mechanism is slightly different.

Modify the casparcg.config <html> segment to reference an IP port number that is used for the debug tools. For example:

<html>
    <enable-gpu>true</enable-gpu>
    <remote-debugging-port>8101</remote-debugging-port>
<html>

The port number may be any free port number on your CasparCG host computer. Restart the server after the configuration change.

Start an instance of Chrome Browser on the CasparCG server host. Enter page address chrome://inspect/#devices

On the displayed page, tick Discover network targets, and click the Configure button. Add the localhost address with the port number defined in the <html> tag - 127.0.0.1:8101 and click the Done button. The value is saved for future visits.

After a few seconds there should be a list of html pages and html templates running in CasparCG server. Click on the inspect text in the entry with your page. A new window opens that has a minature version of the http page at the left, and the standard browser inspection tools in the rest of the window. You can now view any console messages, inspect variables, set breakpoints and trace javascript code processes.

1 Like