Spotify App:如何访问网络摄像头?

时间:2012-10-10 11:53:54

标签: javascript html5 spotify

我尝试通过js / html(getUserMedia)访问网络摄像头。该应用程序在我的apache机器上运行,但不是在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!');
    }
}

1 个答案:

答案 0 :(得分:0)

不幸的是,目前Spotify Apps环境不支持此功能。