2016-04-06 20 views
0

im yakalamak ve iekran küçük bir app yaptığını

sorun şu anda olmasıdır "yakalama" olan ekranını görüntülemek için bir yol olup olmadığını bilmek istiyorum neyi seçtikten sonra sıkışmış Yakalamak için bir ekran seçtikten sonra "durdurmak paylaşımı" beyaz çubuğu veya bunun gibi bir şey göstermiyor, sadece yakalamak için çerçeve seçmek gizler. Bu benim için bir problem çünkü hiçbir şey kaydedemiyorum.

chrome.runtime.onConnect.addListener(function(port){ 
    // listen for messages from the port 

    port.onMessage.addListener(function(message){ 
     // send back a "pending" answer on the port 
     port.postMessage({ 
      "answer": 1, 
      "state": "pending", 
      "requestId": message.requestId 
     }); 

     chrome.desktopCapture.chooseDesktopMedia(["screen", "window"], port.sender.tab, function(id){ 


      var response = { 
       "answer": 1, 
       "state": "completed", 
       "requestId": message.requestId, 
       "streamId": id 
      }; 

      // send back a "completed" answer on the port 
      port.postMessage(response); 
     }); 
    }); 
}); 

biliyorum böylece hata ayıklamak için bir yol yoktur neden paylaşım masaüstü parçası sıkıştı:

bu kod nereye kod parçası mı?

Teşekkürler!

cevap

0

Uzantıyı inspecting it or using the debugger görüntüleyebilirsiniz.

Inspect the popup

As long as your browser is in Developer mode, it's easy to inspect popups.

  1. Go to the Extensions page (chrome://extensions), and make sure Developer mode is still enabled. The Extensions page doesn't need to be open for the following to work. The browser remembers the setting, even when the page isn't shown.
  2. Right-click the extension and choose the Inspect popup menu item. The popup appears, and a Developer Tools window like the following should display the code for popup.html.
  3. If the Scripts button isn't already selected, click it.
  4. Click the console button (second from left, at the bottom of the Developer Tools window) so that you can see both the code and the console.

Use the debugger

  1. Set a breakpoint inside the code code for chrome.desktopCapture.chooseDesktopMedia
  2. Refresh the page and check the debugger.

Ayrıca yaygın olarak kullanılabilir ayıklama API'ler Uzantınızın JavaScript kodu böyle console.log olarak() ve console.error() kullanmayı deneyin.

+0

Hata alıp almadığımı gördüm, ancak birkaç kez kontrol ettikten sonra uzantının bir hata olduğunu fark ettim: Hata: Bağlantısız bir bağlantı noktası nesnesi kullanmayı denemek ama çoğu zaman konsolda hiçbir şey göstermiyor – AbdulHamid

+0

Sorun belki de konuşmada beklenen süreyi uzatır. [Uzun ömürlü bağlantıyı] okumaya çalışın (http://stackoverflow.com/questions/22943988/one-more-time-about-error-attempting-to-use-a-disconnected-port-object-how-to) ve [bağlantıyı yeniden kurma] (http://stackoverflow.com/questions/22943988/one-more-time-about-error-attempting-to-use-a-disconnected-port-object-how-to) adresine Bu hata ile ilgili geçici çözümü kontrol edin. –