小编lov*_*set的帖子

HTML5:相机访问

我很新HTML5.我尝试使用以下HTML5代码访问手机上的相机.它始终显示"不支持本机网络摄像头".似乎我的移动浏览器(safari和android 2.1网络浏览器)不支持相机.

你能告诉我我应该使用哪种浏览器来访问摄像头吗?

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, maximum-scale=1.0">
    <style>
        body {width: 100%;}
        canvas {display: none;}
    </style>
    <script>
        var video, canvas, msg;
        var load = function () {
            video  = document.getElementById('video');
            canvas = document.getElementById('canvas');
            msg    = document.getElementById('error');
            if( navigator.getUserMedia ) {
                video.onclick = function () {
                    var context = canvas.getContext("2d");
                    context.drawImage(video, 0, 0, 240, 320);
                    var image = {"demo" : {
                        "type"  : "device",
                        "image" : canvas.toDataURL("image/png")
                    }};
                };

                var …
Run Code Online (Sandbox Code Playgroud)

html5 camera native

38
推荐指数
5
解决办法
10万
查看次数

如何使用phonegap在Android手机上显示相机

我想在Android手机上使用phonegap捕获图像.我尝试在Phonegap页面上发布的代码,但相机没有出现.非常感谢任何帮助.非常感谢.

这是我手机上的显示屏

它是我手机上的显示器,没有摄像头

<!DOCTYPE html>
<html>
  <head>
    <title>Capture Photo</title>

    <script type="text/javascript" charset="utf-8" src="cordova-1.6.0.js"></script>
    <script type="text/javascript" charset="utf-8">

    var pictureSource;   // picture source
    var destinationType; // sets the format of returned value 

    // Wait for Cordova to connect with the device
    //
    document.addEventListener("deviceready",onDeviceReady,false);

    // Cordova is ready to be used!
    //
    function onDeviceReady() {
        pictureSource=navigator.camera.PictureSourceType;
        destinationType=navigator.camera.DestinationType;
    }

    // Called when a photo is successfully retrieved
    //
    function onPhotoDataSuccess(imageData) {
      // Uncomment to view the base64 encoded image data
      // console.log(imageData);

      // Get image …
Run Code Online (Sandbox Code Playgroud)

camera android cordova

1
推荐指数
1
解决办法
6266
查看次数

标签 统计

camera ×2

android ×1

cordova ×1

html5 ×1

native ×1