You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <html>
  2. <head>
  3. <style>
  4. body {
  5. margin: 0;
  6. }
  7. iframe {
  8. width: 100%;
  9. height: 100%;
  10. border: 0 none;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <script>
  16. var gui = require('nw.gui');
  17. var screenInitialized = false;
  18. function obtainDesktopStream (callback, errorCallback) {
  19. if (!screenInitialized) {
  20. gui.Screen.Init();
  21. screenInitialized = true;
  22. }
  23. gui.Screen.chooseDesktopMedia(
  24. ["window","screen"],
  25. function(streamId) {
  26. var vid_constraint = {
  27. mandatory: {
  28. chromeMediaSource: 'desktop',
  29. chromeMediaSourceId: streamId,
  30. maxWidth: 1920,
  31. maxHeight: 1080
  32. },
  33. optional: []
  34. };
  35. navigator.webkitGetUserMedia({
  36. audio: false, video: vid_constraint
  37. }, callback, function (error) {
  38. errorCallback &&
  39. errorCallback(error, vid_constraint);
  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. // create iframe with jitsi-meet
  55. var iframe = document.createElement('iframe');
  56. iframe.src = nw.App.manifest['jitsi-url'];
  57. iframe.allowFullscreen = true;
  58. iframe.onload = function () {
  59. iframe.contentWindow.JitsiMeetNW = {
  60. obtainDesktopStream: obtainDesktopStream
  61. };
  62. };
  63. document.body.appendChild(iframe);
  64. </script>
  65. </body>
  66. </html>