rpicamsrc: webrtc example: Modify HTML to support other ports than 57778
authorJan Schmidt <jan@centricular.com>
Thu, 21 Jun 2018 12:44:25 +0000 (22:44 +1000)
committerTim-Philipp Müller <tim@centricular.com>
Fri, 10 Jul 2020 15:46:28 +0000 (16:46 +0100)
tests/examples/rpicamsrc/webrtc-unidirectional-h264.c

index 775db19..9538ede 100644 (file)
@@ -132,10 +132,13 @@ const gchar *html_source = " \n \
  \n \
  \n \
       function playStream(videoElement, hostname, port, path, configuration, reportErrorCB) { \n \
-        var wsHost = (hostname != undefined) ? hostname : window.location.hostname; \n \
-        var wsPort = (port != undefined) ? port : 57778; \n \
+        var l = window.location;\n \
+        var wsHost = (hostname != undefined) ? hostname : l.hostname; \n \
+        var wsPort = (port != undefined) ? port : l.port; \n \
         var wsPath = (path != undefined) ? path : \"ws\"; \n \
-        var wsUrl = \"ws://\" + wsHost + \":\" + wsPort + \"/\" + wsPath; \n \
+        if (wsPort) \n\
+          wsPort = \":\" + wsPort; \n\
+        var wsUrl = \"ws://\" + wsHost + wsPort + \"/\" + wsPath; \n \
  \n \
         html5VideoElement = videoElement; \n \
         webrtcConfiguration = configuration; \n \