jitsi iframe capturelargevideoscreenshot返回空图像

gj3fmq9x  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(332)

你好,我一直在努力学习jitsi。在我研究的一个特定部分,我必须截屏并在img对象上显示它。但不幸的是,我无法做到这一点。如果你们能帮助我,我将不胜感激。这对我来说至关重要。
先谢谢你
这就是我想在其中展示的img对象

  1. var image = document.createElement('img');
  2. image.src=url;
  3. image.width=1000;
  4. image.height=1000;
  5. image.alt="here should be some image";
  6. document.body.appendChild(image);
  7. });

下面是代码块:
myapp1js

  1. function StartMeeting(){
  2. const domain = 'meet.jit.si';
  3. const options = {
  4. roomName: 'alper2323',
  5. width: 700,
  6. height: 700,
  7. parentNode: document.querySelector('#jitsi-meet-conf-container')
  8. };
  9. apiObj = new JitsiMeetExternalAPI(domain, options);
  10. }
  11. function HangupCall(){
  12. apiObj.captureLargeVideoScreenshot().then(data => {
  13. // data is an Object with only one param, dataURL
  14. data.dataURL = "data:image/png;base64,iVBORw0KalpoAAAANSUhEUgAABQAA"
  15. var blob = new Blob([data.dataURL], {type: "image/png"}),
  16. url = URL.createObjectURL(blob),
  17. img = new Image();
  18. img.onload = function() {
  19. URL.revokeObjectURL(this.src); // clean-up memory
  20. document.body.appendChild(this); // add image to DOM
  21. }
  22. alert(url);
  23. var image = document.createElement('img');
  24. image.src=url;
  25. image.width=1000;
  26. image.height=1000;
  27. image.alt="here should be some image";
  28. document.body.appendChild(image);
  29. });
  30. }

jitsitest.html

  1. <html>
  2. <head>
  3. <style>
  4. .container {
  5. position: relative;;
  6. width: 1080px;
  7. height:720px;
  8. border:1px red solid;
  9. }
  10. </style>
  11. <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  12. <script src="https://meet.jit.si//external_api.js"></script>
  13. <script src="myapp1.js"></script>
  14. <script>
  15. $(function(){
  16. $('#btnStart').on('click',function(){
  17. StartMeeting();
  18. });
  19. $('#btnHangup').on('click',function(){
  20. HangupCall();
  21. });
  22. });
  23. </script>
  24. </head>
  25. <body>
  26. <button id='btnStart'>Start</button>
  27. <div class="container">
  28. <div class="toolbox">
  29. <button id='btnHangup'>Hangup</button>
  30. </div>
  31. <div id='jitsi-meet-conf-container'></div>
  32. </div>
  33. <div class="container">
  34. <div id='jitsi-meet-conf-container'></div>
  35. </div>
  36. </body>
  37. </html>

myapp.js

  1. var apiObj = null;
  2. function StartMeeting()
  3. {
  4. const domain = 'meet.jit.si';
  5. const options = {
  6. roomName: 'AlperRoom',
  7. width: '100%',
  8. height: '100%',
  9. parentNode: document.querySelector('#jitsi-meet-conf-container'),
  10. userInfo: {
  11. displayName: 'Alper SARAÇ'
  12. },
  13. configOverwrite:{
  14. },
  15. interfaceConfigOverwrite: {
  16. DISPLAY_WELCOME_PAGE_CONTENT: false,
  17. TOOLBAR_BUTTONS: [
  18. 'microphone', 'camera'
  19. ],
  20. },
  21. onload: function () {
  22. alert('loaded');
  23. }
  24. };
  25. apiObj = new JitsiMeetExternalAPI(domain, options);
  26. apiObj.addEventListeners({
  27. readyToClose: function () {
  28. alert('going to close');
  29. $("#jitsi-meet-conf-container").empty();
  30. }
  31. });
  32. apiObj.executeCommand('subject', '');
  33. }
  34. function HangupCall(){
  35. apiObj.executeCommand('hangup');
  36. }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题