zoukankan      html  css  js  c++  java
  • phonegap入门7 capture.captureVideo 录像

    capture.captureVideo

    开启视频录制应用程序,返回采集到的视频剪辑文件信息。

    navigator.device.capture.captureVideo( 
        CaptureCB captureSuccess, CaptureErrorCB captureError, [CaptureVideoOptions options]
    );

    该方法通过设备的视频录制应用程序开始一个异步操作以采集视频录制。该操作允许设备用户在一个会话中同时采集多个视频录制。
    当用户退出视频录制应用程序,或系统到达CaptureVideoOptions的limit参数所定义的最大录制数时都会停止采集操作。如果没有设置limit参数的值,则使用其默认值1,也就是说当用户录制到一个视频剪辑后采集操作就会终止。
    当采集操作结束后,系统会调用CaptureCB回调函数,传递一个包含每个采集到的视频剪辑文件的MediaFile对象数组。如果用户在完成一个视频剪辑采集之前终止采集操作,系统会调用CaptureErrorCB回调函数,并传递一个包含CaptureError.CAPTURE_NO_MEDIA_FILES错误代码的CaptureError对象。
    下面一个例子代码:

    <?xml version="1.0" encoding="utf-8"?>
    <!--
           Licensed to the Apache Software Foundation (ASF) under one
           or more contributor license agreements.  See the NOTICE file
           distributed with this work for additional information
           regarding copyright ownership.  The ASF licenses this file
           to you under the Apache License, Version 2.0 (the
           "License"); you may not use this file except in compliance
           with the License.  You may obtain a copy of the License at
    
             http://www.apache.org/licenses/LICENSE-2.0
    
           Unless required by applicable law or agreed to in writing,
           software distributed under the License is distributed on an
           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
           KIND, either express or implied.  See the License for the
           specific language governing permissions and limitations
           under the License.
    -->
    <cordova>
        <!--
        access elements control the Android whitelist.
        Domains are assumed blocked unless set otherwise
         -->
    
        <access origin="http://127.0.0.1*"/> <!-- allow local pages -->
    
        <!-- <access origin="https://example.com" /> allow any secure requests to example.com -->
        <!-- <access origin="https://example.com" subdomains="true" /> such as above, but including subdomains, such as www -->
        <access origin=".*"/>
    
        <!-- <content src="http://mysite.com/myapp.html" /> for external pages -->
        <content src="capture.captureVideo.html" />
    
        <log level="DEBUG"/>
        <preference name="useBrowserHistory" value="true" />
        <preference name="exit-on-suspend" value="false" />
    <plugins>
        <plugin name="App" value="org.apache.cordova.App"/>
        <plugin name="Geolocation" value="org.apache.cordova.GeoBroker"/>
        <plugin name="Device" value="org.apache.cordova.Device"/>
        <plugin name="Accelerometer" value="org.apache.cordova.AccelListener"/>
        <plugin name="Compass" value="org.apache.cordova.CompassListener"/>
        <plugin name="Media" value="org.apache.cordova.AudioHandler"/>
        <plugin name="Camera" value="org.apache.cordova.CameraLauncher"/>
        <plugin name="Contacts" value="org.apache.cordova.ContactManager"/>
        <plugin name="File" value="org.apache.cordova.FileUtils"/>
        <plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>
        <plugin name="Notification" value="org.apache.cordova.Notification"/>
        <plugin name="Storage" value="org.apache.cordova.Storage"/>
        <plugin name="FileTransfer" value="org.apache.cordova.FileTransfer"/>
        <plugin name="Capture" value="org.apache.cordova.Capture"/>
        <plugin name="Battery" value="org.apache.cordova.BatteryListener"/>
        <plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
        <plugin name="Echo" value="org.apache.cordova.Echo" />
        <plugin name="Globalization" value="org.apache.cordova.Globalization"/>
        <plugin name="InAppBrowser" value="org.apache.cordova.InAppBrowser"/>
    </plugins>
    </cordova>
    

    截图如下:


  • 相关阅读:
    LeetCode 43 字符串相乘
    HDU 1031 Design T-Shirt
    HDU 1728 逃离迷宫
    HDU 1285 确定比赛名次
    HDU 1116 Plays on words
    HDU 1195 Open the lock
    HDU 1072 Nightmare
    HDU 1272 小希的迷宫
    HDU 1273 漫步森林
    HDU 1269 迷宫城堡
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/3031542.html
Copyright © 2011-2022 走看看