无法播放使用Android版Chrome一个blob的URL视频 [英] Can't play a blob-url video using Chrome for Android

查看:815
本文介绍了无法播放使用Android版Chrome一个blob的URL视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在面临一个不寻常的问题,而试图记录和Chrome中播放的视频为Android。 (同code正常工作在Chrome桌面)。

I'm facing an unusual issue while trying to record and play a video in Chrome for Android. (Same code works fine on Chrome for Desktop).

首先,一些信息:


  • 是Android 4.4.2

  • Android版Chrome 40.0.2214.89

  • 它适用于Chrome浏览器的桌面40.0.2214.94米

  • 在本地文件存储BLOB后,它的正确的媒体播放器应用程序内再现。

  • 必需RecordRTC.js

我的目标是,记录来自平板电脑的摄像头的视频,比播放录制的视频。
这里有一个例子code:

My goal is that to record a video from tablet's camera and than play the recorded video. Here's an example code:

<!DOCTYPE html>
<html>
    <head>
        <title>Camera Test</title>
    <script type="text/javascript" src="//cdn.WebRTC-Experiment.com/RecordRTC.js"></script>
    </head>
    <body>

<script>


var cameraStream;
var cameraEl;
var cameraRecorder;
var cameraBlobURL;

window.URL = window.URL || window.webkitURL; 
navigator.getUserMedia = (  navigator.getUserMedia ||
                            navigator.webkitGetUserMedia ||
                            navigator.mozGetUserMedia ||
                            navigator.msGetUserMedia);



function askForCamera(){
    navigator.getUserMedia(
        { 
            video : true 
        },
        function(stream) {
            cameraStream = stream;
            cameraEl = document.getElementById("vidCamera");
            cameraEl.src = window.URL.createObjectURL(stream);  
        },
        function(){
            alert('fail camera');
        }
    );
}


function playCamera(){
    cameraEl.play();
}


function startRec(){
    cameraRecorder = RecordRTC(
                    cameraStream, 
                    {
                        type: 'video',
                        disableLogs : true
                    }
    );              
    cameraRecorder.startRecording();            
}

function stopRec(){
    cameraRecorder.stopRecording(function(blobURL){
        cameraBlobURL = blobURL;
        console.log(cameraBlobURL);
        alert(cameraRecorder.getBlob().type + '     ' +cameraRecorder.getBlob().size);

    });
}

function setBlob(){
    cameraEl.src = cameraBlobURL;   
}


</script>


<p>Buttons:</p>
<button type="button" onclick="askForCamera()">Ask for camera</button>
<button type="button" onclick="playCamera()">Play camera</button>
<button type="button" onclick="startRec()">Start Rec</button>
<button type="button" onclick="stopRec()">Stop Rec</button>

<button type="button" onclick="setBlob()">Set blob to camera</button>
<button type="button" onclick="playCamera()">Play camera</button>

<br/>
<p>Camera:</p>
<video id="vidCamera" width="200" height="200">
</video>



    </body>
</html>

我应该如何进行,以确保它适用于Android版Chrome?
希望有人能帮助我。
感谢所有!

How should I proceed in order to make sure it works on Chrome for Android? Hope someone can help me. Thanks to all!

推荐答案

我也遇到了在Chrome 41这个问题,并认为它是一个错误。也许这个问题:

I've also run into this problem on Chrome 41 and believe its a bug. Possibly this issue:

HTTPS://$c$c.google。 COM / p /铬/问题/细节?ID = 253465

这篇关于无法播放使用Android版Chrome一个blob的URL视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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