移动浏览器将支持getUserMedia吗? [英] Will and When will Mobile Browers support getUserMedia?

查看:283
本文介绍了移动浏览器将支持getUserMedia吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用HTML5 / WebRTC API(见下面的代码)编写了一个Web应用程序。这适用于Chrome v20(启用MediaStream标志)和最新的FF Nightly build 17.0a1(带有media.navigator.enabled前缀创建并设置为true)。我还没有得到它在Opera上的工作。



然而,我的问题是,这将工作在这些浏览器的未来移动版本?如果是这样的话?

  if(navigator.webkitGetUserMedia){
//对于WebKit(Chrome / Safari)
navigator.webkitGetUserMedia({video:true,audio:false},function(localMediaStream){
$(#video)。attr(src,window.webkitURL.createObjectURL(localMediaStream));
},函数(e){
console.log(e);
});
} else if(navigator.mozGetUserMedia){
//对于Firefox
navigator.mozGetUserMedia({video:true},函数(localMediaStream){
var video = document.querySelector ('video');
video.src = localMediaStream;
video.play();
},function(e){
console.log(e);
});
} else if(navigator.getUserMedia){
// For Opera
navigator.getUserMedia({audio:false,video:true},function(localMediaStream){
$( #video)。attr(src,localMediaStream);
},function(e){
console.log(e);
});


解决方案

目前 Opera Mobile 12.0仅支持getUserMedia API ,但是我预计其他移动客户端将会在2013年初开始支持它。 / p>

于2014年5月21日星期三上午3:57更新(UTC)

现在,所有主要的三个浏览器都支持WebRTC ( getUserMedia + PeerConnection + RTCDataChannel ):


  1. Firefox - Google App Store链接

  2. Chrome - 与Google App Store链接

  3. Opera - 其Google App Store链接

您可以使用 cross-walk project 并将你的HTML编译成跨平台的apk文件,它将起作用!它支持所有的WebRTC功能,例如:getUserMedia + PeerConnection + RTCDataChannel 。

I have written a web app using the 'bleeding edge' HTML5/WebRTC API's (See code below). This works on Chrome v20 (with MediaStream flag enabled) and latest FF Nightly build 17.0a1 (with "media.navigator.enabled" pref created and set to true). I havent yet got it working on Opera.

However, my question is, will this work on future mobile versions of these browers? and If so when?

if(navigator.webkitGetUserMedia){   
   //For WebKit (Chrome/ Safari)
   navigator.webkitGetUserMedia({video: true, audio: false}, function(localMediaStream)      {
          $("#video").attr("src",window.webkitURL.createObjectURL(localMediaStream)); 
    }, function(e) {
      console.log(e);
    });
}else if(navigator.mozGetUserMedia){
  //For Firefox
  navigator.mozGetUserMedia({video: true}, function(localMediaStream) {
  var video = document.querySelector('video');  
  video.src = localMediaStream;
  video.play();
    },  function(e) {
      console.log(e);
    });
}else if(navigator.getUserMedia){
    //For Opera
    navigator.getUserMedia({audio: false, video: true}, function(localMediaStream) {
    $("#video").attr("src", localMediaStream);                                  
    },  function(e) {
      console.log(e);
    });
}

解决方案

Currently Opera Mobile 12.0 only support getUserMedia API - however I'm expecting that other mobile clients 'll start supporting it at the beginning of the 2013.

Updated at 3:57 am - Wednesday, 21 May 2014 (UTC)

Now, all major three browsers are supporting WebRTC (getUserMedia + PeerConnection + RTCDataChannel) on android:

  1. Firefox - its a Google App Store link
  2. Chrome - its a Google App Store link
  3. Opera - its a Google App Store link

You can use cross-walk project and compile your HTML into cross-platform apk files and it will work! It supports All WebRTC features i.e. getUserMedia + PeerConnection + RTCDataChannel.

这篇关于移动浏览器将支持getUserMedia吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆