2012-10-10 51 views
0

我試圖通過js/html(getUserMedia)訪問攝像頭。該應用程序在我的apache機器上運行,但不是作爲Spotify應用程序中的靜態文件運行。Spotify應用程序:如何訪問攝像頭?

任何想法?

function start() 
{ 
    if ((typeof window === 'undefined') || (typeof navigator === 'undefined')) log('This page needs a Web browser with the objects window.* and navigator.*!'); 
    else if (!(video && canvas)) log('HTML context error!'); 
    else 
    { 
     log('Get user media…'); 
     if (navigator.getUserMedia) navigator.getUserMedia({video:true}, gotStream, noStream); 
     else if (navigator.oGetUserMedia) navigator.oGetUserMedia({video:true}, gotStream, noStream); 
     else if (navigator.mozGetUserMedia) navigator.mozGetUserMedia({video:true}, gotStream, noStream); 
     else if (navigator.webkitGetUserMedia) navigator.webkitGetUserMedia({video:true}, gotStream, noStream); 
     else if (navigator.msGetUserMedia) navigator.msGetUserMedia({video:true, audio:false}, gotStream, noStream); 
     else log('getUserMedia() not available from your Web browser!'); 
    } 
} 

回答

0

不幸的是,目前在Spotify應用程序環境中不支持此功能。