简体   繁体   English

Windows 8桌面应用程序的视频捕获(HTML + javascript)。 不是来自网络摄像头

[英]Video capture for Windows 8 desktop App (HTML + javascript). Not from webcam

I´m developing a Windows 8.1 App for desktop using HTML and Javascript. 我正在使用HTML和Javascript开发用于桌面的Windows 8.1应用程序。 I have a video grabber card and i would like to view the video being captured in real-time at my App. 我有一张视频采集卡,我想在我的应用程序中实时查看正在捕获的视频。 Searching the internet i´ve found some examples and tutorial of capturing video for a Windows 8 App, but all of them are with the webcam, and i would like to know if that should be applicable to any "capture device" like my capture card. 在互联网上搜索,我发现了一些示例和捕获Windows 8 App视频的教程,但是所有这些都与网络摄像头一起使用,我想知道这是否适用于任何“捕获设备”(例如我的捕获卡) 。

I´ve followed this MSDN tutorial with no success. 我没有成功完成此MSDN教程。

http://msdn.microsoft.com/en-us/library/windows/apps/hh452791.aspx http://msdn.microsoft.com/en-us/library/windows/apps/hh452791.aspx

EDIT (adding some more info): 编辑(添加更多信息):

If you follow the tutorial, the detection of capture devices whith the code bellow is ok, it properly detects my capture card. 如果您按照本教程进行操作,则可以通过下面的代码检测捕获设备,从而正确检测到我的捕获卡。

var deviceInfo = Windows.Devices.Enumeration.DeviceInformation;
    deviceInfo.findAllAsync(Windows.Devices.Enumeration.DeviceClass.videoCapture).then(function (devices) {

        // Add the devices to deviceList

        if (devices.length > 0) {

            for (var i = 0; i < devices.length; i++) {
                deviceList.push(devices[i]);              
            }

            initCaptureSettings();
            initMediaCapture();
            document.getElementById("message").innerHTML = "Initialization complete.";

        } else {
            document.getElementById("error").innerHTML("No video device is found ");
        }
    }, errorHandler);

But then, it throws an "Access denied" exception at the "oMediaCapture.initializeAsync(captureInitSettings)" at the following section of code: 但是随后,它在以下代码部分的“ oMediaCapture.initializeAsync(captureInitSettings)”处引发“访问被拒绝”异常:

// Create and initialze the MediaCapture object.
function initMediaCapture() {
    oMediaCapture = null;
    oMediaCapture = new Windows.Media.Capture.MediaCapture();
    oMediaCapture.initializeAsync(captureInitSettings).then (function (result) {
       createProfile();
    }, errorHandler);
}

I think this could be because of some kind of access permission to the capture device ¿?¿? 我认为这可能是因为对捕获设备有某种访问权限。 Any help? 有什么帮助吗?

Thanks in advance!! 提前致谢!!

If you only care about the video and do not want to use the audio, just make sure that the settings passed to InitializeAsync() specifies StreamingCaptureMode correctly: 如果您只关心视频而又不想使用音频,则只需确保传递给InitializeAsync()的设置正确指定了StreamingCaptureMode:

            mediaCapture = new MediaCapture();

            MediaCaptureInitializationSettings initSettings = new MediaCaptureInitializationSettings();
            initSettings.VideoDeviceId = Webcam.Id;
            initSettings.StreamingCaptureMode = StreamingCaptureMode.Video;  // <----

            await mediaCapture.InitializeAsync(initSettings);

Kudos to Slimacik. 对Slimacik表示敬意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从网络摄像头捕获视频并将其上传到服务器? - how to capture video from webcam and upload it to server? Twilio从本地网络摄像头结束视频捕获 - Twilio End Video Capture from Local Webcam 使用 HTML5 和 JavaScript 从视频中捕获帧 - Capture frames from video with HTML5 and JavaScript 如何将来自IP Webcam应用程序的jpeg流用作html5视频标签中的src? - How to use jpeg stream from IP Webcam app as src in html5 video tag? Windows 8(JavaScript):多个 <video> 具有相同网络摄像头源的标签:可能吗? - Windows 8 (JavaScript): Multiple <video> tags with same webcam source: Possible? 您可以使用Javascript在iPhone上从网络摄像头捕获图像吗? - Can you capture an image from the webcam on an iphone in Javascript? 使用JavaScript从网络摄像头捕获图像而无需刷新页面 - Capture image from webcam with JavaScript without page refresh 从网络摄像头捕获图像并使用PHP和JavaScript保存在文件夹中 - Capture image from webcam and save in folder using PHP and JavaScript 从网络摄像头捕获图像并在 javascript 中转换为 base64 - Capture image from webcam and convert to base64 in javascript 从 HTML 中的网络摄像头获取视频帧并将其用于 OPENCV python - Get video frames from webcam in HTML and use it for OPENCV python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM