Przeglądaj źródła

integrate with nwjs

master
isymchych 9 lat temu
rodzic
commit
72a761e80a
2 zmienionych plików z 76 dodań i 0 usunięć
  1. 68
    0
      nwjs-integration/index.html
  2. 8
    0
      nwjs-integration/package.json

+ 68
- 0
nwjs-integration/index.html Wyświetl plik

1
+<html>
2
+    <head>
3
+
4
+        <style>
5
+            body {
6
+                margin: 0;
7
+            }
8
+
9
+            iframe {
10
+                width: 100%;
11
+                height: 100%;
12
+                border: 0 none;
13
+            }
14
+        </style>
15
+    </head>
16
+    <body>
17
+        <script>
18
+            var gui = require('nw.gui');
19
+            var screenInitialized = false;
20
+            function obtainDesktopStream (callback, errorCallback) {
21
+                if (!screenInitialized) {
22
+                    gui.Screen.Init();
23
+                    screenInitialized = true;
24
+                }
25
+                gui.Screen.chooseDesktopMedia(
26
+                    ["window","screen"],
27
+                    function(streamId) {
28
+                        var vid_constraint = {
29
+                            mandatory: {
30
+                                chromeMediaSource: 'desktop',
31
+                                chromeMediaSourceId: streamId,
32
+                                maxWidth: 1920,
33
+                                maxHeight: 1080
34
+                            },
35
+                            optional: []
36
+                        };
37
+                        navigator.webkitGetUserMedia({
38
+                            audio: false, video: vid_constraint
39
+                        }, callback, errorCallback);
40
+                    }
41
+                );
42
+            }
43
+
44
+            // use Esc to leave fullscreen mode
45
+            nw.App.registerGlobalHotKey(new nw.Shortcut({
46
+                key: "Escape",
47
+                active: function () {
48
+                    var win = nw.Window.get();
49
+                    if (win.isFullscreen) {
50
+                        win.leaveFullscreen();
51
+                    }
52
+                }
53
+            }));
54
+
55
+            // create iframe with jitsi-meet
56
+            var iframe = document.createElement('iframe');
57
+            iframe.src = nw.App.manifest['jitsi-url'];
58
+            iframe.allowFullscreen = true;
59
+            iframe.onload = function () {
60
+                iframe.contentWindow.JitsiMeetNW = {
61
+                    obtainDesktopStream: obtainDesktopStream
62
+                };
63
+            };
64
+
65
+            document.body.appendChild(iframe);
66
+        </script>
67
+    </body>
68
+</html>

+ 8
- 0
nwjs-integration/package.json Wyświetl plik

1
+{
2
+    "name": "JitsiMeetNW!",
3
+    "version": "0.0.1",
4
+    "jitsi-url": "https://ivan.jitsi.net/",
5
+    "main": "index.html",
6
+    "chromium-args": "--ignore-certificate-errors",
7
+    "user-agent": "Chrome/%webkit_ver JitsiMeetNW/%ver"
8
+}

Ładowanie…
Anuluj
Zapisz