【小(xiǎo)編推薦】phonegap 捕獲圖片,音(yīn)頻(pín),↑<視(shì)屏api capture

2014-05-21  &n£≠§bsp;|   發布者:£←↔梁國(guó)芳   |&nbs ♥p;  查看(kàn)∏★:3320次

app開(kāi)發
一(yī)、capture Api 簡單介紹

      c♦★♠¥apture 對(duì)象用(yòng)于獲取視(shì)屏,音(yī"±↕n)頻(pín)和(hé)圖像,它是(shì)一(yī)個(gè)全局®>對(duì)象,通(tōng)過

    δ₹;  navigator.device.capture 來(​₹ lái)訪問(wèn)

     ₩£; 方法:

   &nbs ←Ωp;    & <γnbsp; capture.captureAudio 捕獲音(yīn)頻( ★​pín)
      &δ±nbsp;   capture.captureI♦♥>÷mage 捕獲圖片
     &nbφπsp;    ™∑©'capture.captureVideo 捕獲視(shì)♠∏屏

     &nbs☆><p;    MediaFil★→&↑e.getFormatData 獲取媒體(tǐ)文(wén)件(jiàn)的€↔ (de)格式信息

二、captureAudio &nb₹π≠δsp;    &nb₽Ωsp;    捕獲音(yīn)頻(pín)

navigator.device.captureΩ≈.captureAudio(CaptureCB captureSuφ≥♦Ωccess,

   &n ¶✔‍bsp;     ₩φ↕    &n​±bsp;   Captσ∑≤ureErrorCB captureErroα↔∏≈r, [CaptureAudioOptio" ns options] );

// 限制(zhì)采集上(shàng)限為(wèi)3個(gè)媒體(tǐ$←₹↔)文(wén)件(jiàn),每個(gè)文(wén)件(jiàn)不(bù¥σ)超過10秒(miǎo)
var options = { limit: 3, du★σ☆&ration: 10 };

navigator.device.capture$♦£✘.captureAudio(captureSuccess, ca±§ptureError, options);

說(shuō)明(míng):
該方法通(tōng)過設備默認的(de)音(yīn)頻(pí ©εn)錄制(zhì)應用(yòng)程序開(kāi)始一(↓>₹→yī)個(gè)異步操作(zuò)以采集音(yīn)頻(pínα≤)錄制(zhì)。該操作(zuò)允許設
備用(yòng)戶在一(yī)個(gè)會(huì)話(huà)中同時(sε∑♥‌hí)采集多(duō)個(gè)錄音(yīδ™n)。

--------------------♣Ω$--- Page 2-----------------------

當用(yòng)戶退出音(yīn)頻(pín)錄制(zhì)應用(yò₹'×ng)程序,或系統到(dào)達CaptureAudioOptioφ•¥ns 的(de)limit參數(shù)所定義的(de)最
大(dà)錄制(zhì)數(shù)時(shí)都(dōu)會(huì)停止✘×↕♥采集操作(zuò)。如(rú)果沒有(yǒu)設置limit參數(shù)的(​ε♣de)值,則使用(yòng)其默認值1,也(yě)就(jiù)是(₩λshì)
說(shuō)當用(yòng)戶錄制(zhì)好(hǎo)一(yī∑£§≈)個(gè)音(yīn)頻(pín)剪輯後采集→®& 操作(zuò)就(jiù)會(huì)終止。

當采集操作(zuò)結束後,系統會(huì)調用(yòng≥× •)CaptureCB 回調函數(shù),傳遞一(yī→')個(gè)包含所有(yǒu)采集到(dà♠<o)的(de)音(yīn)頻(pín)剪輯
文(wén)件(jiàn)的(de)Media♦§©File 對(duì)象數(shù)組。如(rúφεα≤)果用(yòng)戶在完成一(yī)個(gè)音(yīn)頻(pín)£‍φφ剪輯采集之前終止采集操作(zuò),系統會≥£(huì)
調用(yòng)CaptureErrorCB 回調函數(shù),×≤并傳遞一(yī)個(gè)包含CaptureError.CAPTURE_NO ∞_MEDIA_FILES

錯(cuò)誤代碼的(de)CaptureError 對(duì)象。₩&★

limit:在單個(gè)采集操作(zuò)期間(jiān)能(néng)夠記∑$‍ 錄的(de)音(yīn)頻(pín)剪輯數(sh✔φù)量最大(dà)值,必須設定為(wèi)大(dà)于等于1(默認

值為(wèi)1)。
duration:一(yī)個(gè)音(yīn)頻(pín)剪輯的β∏$₩(de)最長(cháng)時(shí)間( •jiān),單位為(wèi)秒(miǎoγ ↓)。
mode:選定的(de)音(yīn)頻(pín)模式,必須設定為(wèi)c÷ apture.supportedAudioModes 枚舉中¥©♠的(de)值。

<!DOCTYPE HTML>↔φ;
<html>

<head>
<meta charset="utf-8"ε₹♣>
<title>PhoneGap-Capture</titΩ₩le>

<link rel="styleshee♠ ✘t" href="../jquer↑∏→y.mobile-1.1.1/jquery.mobile-1.1.1.css'∑÷" />
<script src="../jquery.mobile♣™≤-1.1.1/jquery.js">♥£δ;</script>
<script src="../jquery.mobile-1∏<↔®.1.1/jquery.mobile-1.1.1.js">&∑™π₽lt;/script>

<script type="text×βπ♥/javascript" charset="u≈↓♦↑tf-8" src="../cordova-1.9.0☆§.js"></script>
<script type="text/javascript&q™ ≥γuot;>
     $(docu‍§ment).ready(function(){

      &n'™↓bsp;     &nσε•bsp;   document.a¥≠ddEventListener("de₩εφviceready", myD↕¶♥eviceReadyListener, falseε¶);
   &nbs↕∞★p; });

   &nb≈ ≠‌sp; myDeviceReadyListener λ±= function(){
      &≈₽nbsp;    ×§£$("#btn_captureAudi®Ω∑o").click(funct₹↑→ion(){
     ✘§↔      &¥α nbsp;    navigat≥  or.device.capture.captureAudio(cap<☆©tureSuccess, captureErro∞₹αr,{limit:3});

     &nb×φ☆÷sp;   &n≥₩¶¥bsp; });
     }©±§↓

   &n↑$‌bsp;     &nβ≥÷bsp; captureSuccess = ≤×Ω function(mediaFiles){
      &‌® πnbsp;    &nbs∑$‍←p;    c♣₩onsole.log("調用(yòng)錄音(yīn)設備 <£¶成功");
     &↑​₽≈nbsp;    &nb✘©' sp;     for≥πδ♣(var i=0;i<mediaFiles.leng≈"®₹th;i++) {

    εδ→;    γΩβ;    &≥​€nbsp;     &nb₩≤"sp;  console.log("文(wén)件(jià∞ ✔n)" + i);
   &nb±≥≤↓sp;   &nb &✔§sp;   &nbs∏×β™p;   &nb ↕sp;   &n©↔←$bsp; console.log("nam♠∏✘§e--->" + media$$ Files[i].name);
    &n<€"bsp;   &nb→≠sp;    &nb±♦↑ sp;    →×φ"   console.log("fullPat≠"‍h--->" + mediaFilδ♣es[i].fullPath);

    &nb≈★↓↔sp;     &nbσ∞♥φsp;     &nb≈∏sp;    conε★α✔sole.log("type--->&₩♣∞quot; + mediaFiles[i].typ<&✔≤e);
    &≈β←nbsp;     Ω→‌';   &n₹∞↕&bsp;   &n"×≤≥bsp;   console.log("la↕™∞stModifiedDate--->" + mediaFile≥©$≠s[i].lastModifiedDate);
      &nb≤‌sp;   φ    &nb‌ ¶sp;     &<πnbsp; console.log("size--->&q☆ε♦uot; + mediaFiles[i].size);

    ∏¥✘σ      ε‌∏∑;     ★☆> }
    &‍ ≈nbsp;      }

----------------------- Page 3------εβ Ω-----------------

   &n×$₩≠bsp;     ±$∑≤; captureError=function(err){

     &≈∞nbsp;     &n±$≈≥bsp;  console.log(&quo₩→≤♦t;調用(yòng)錄音(yīn)設備失敗λ☆," + err);
     &§¶≤nbsp;    }
</script>

</head>
<body>
   &nbsα←₩↔p; <div data-role="φ page">

    &÷©€nbsp;     <div d¶♣₹‍ata-role="header">
     &<←nbsp;   &nb₹≥'sp;    <h1>₩↑‍Capture</h1>
    ←σ ∑     <©" </div>

      α÷     <div data®±₹"-role="content&q×↕¥←uot;>
   &nb" ↑sp;    ∞' ;   &n♦≈‍∑bsp;  <a   id="✔♠ ∞;btn_captureAudio"  £Ω; href="#"  data-rol♥δ✘e="button">¶<→ε;啓動錄音(yīn)器(qì)進行(xíng)錄音(✘€★εyīn)
</a>

     &nbs∑ε‍p;    </div>≠↓↔≤;
      &λ≤σ∏nbsp;   <div ☆σdata-role="footer">
     π≤>;      &n‍ε♥bsp;  <h4>&÷ εamp;nbsp;</h4>

   &nbs↔ p;    &nb✘✔≤sp; </div>
     &l€×₽t;/div>
</body>

</html>

三、capture.captureImag÷©e 捕獲圖片

開(kāi)啓攝像頭應用(yòng)程序,返回采集到(dào₹δ)的(de)圖像文(wén)件(jiàn)信息。

navigator.device.capture.captureIma$‌ge(

     CaptureCB ca§​ptureSuccess, CaptureErrorCB cap♥λ☆tureError, [CaptureI∏©♠$mageOptions options]

);

該方法通(tōng)過設備的(de)攝像頭應用(yòng)程序開(k™↔ "āi)始一(yī)個(gè)異步操作(zuò)以采集圖像。¶©該操作(zuò)允許設備用(yòng)戶在一(yī)個(gè)會(h®€uì)話(huà)中同時(shí)

采集多(duō)個(gè)圖像。

當用(yòng)戶退出攝像頭應用(yòng)程序,或系統到‍​φ(dào)達CaptureImageOptions®$ 的(de)limit參數(shù)所定義的(de)最大(dλ☆à)圖像數(shù)時(shí)都(dōu)會(huì)

停止采集操作(zuò)。如(rú)果沒有(yǒu)設置l•β÷imit參數(shù)的(de)值,則使用(yòng)£↑其默認值1,也(yě)就(jiù)是(shì®× )說(shuō)當用(yòng)戶采集到(dàoπ↔")一(yī)個(gè)圖像後采

集操作(zuò)就(jiù)會(huì)終止。

當采集操作(zuò)結束後,系統會(huì)調用(yòng$ )CaptureCB 回調函數(shù),傳遞一(yī)&£↕♥個(gè)包含每個(gè)采集到(dào)的(de)圖像文(wén) ↓件(jiàn)的(de)MediaFile

對(duì)象數(shù)組。如(rú)果用(yòng)戶在完成一(yī)個Ω±☆(gè)圖像采集之 前終止采集操作(zuò)¶→βΩ,系統會(huì)調用(yòng)CaptureErrorCB 回調函數(sh↓γ₽βù),并

傳遞一(yī)個(gè)包含 CaptureErro₩✔≥>r.CAPTURE_NO_MEDIA_FILES 錯(cuò)誤代&♠碼的(de)CaptureError 對(d★ ∏★uì)象。

比起camera提供的(de)照(zhào)相(xiàn→∏≤↔g)功能(néng),改對(duì)象提供的(de)方法比較簡單

<!DOCTYPE HTML>

<html>

<head>

<meta charset="utf-8"α♣>

<title>PhoneGap-Capture</title★α★">

----------------------- Page 4------ε®✔<-----------------

<link rel="stylesheet" ₹♦☆href="../jquery.mobil®φλe-1.1.1/jquery.mobile-1.1•>≠.1.css" />

<script src="♥∏;../jquery.mobile-1.1.1/jquery.js"$✔></script>

<script src="../jquery.mo&✔πbile-1.1.1/jquery.mobile-1.1Ω<↔♠.1.js"></script&ε↓gt;

<script type="text/javascript®±₹✔" charset="utf-8" srcπδ="../cordova-1.9.0.js">±ββ$</script>

<script type="text/javascript&qε∏uot;>

   &n≠↔¶bsp; $(document).ready(func∏✘≤tion(){

     &n§ bsp;    λβ↕    do→★cument.addEventListener(&quo♣→t;deviceready", myDeviceReadyLi≤✘stener, false);

     });

     myDeviceReady♠ββ×Listener = function(){

    ‌∑σ↓    $("#btn'₹_captureImage").click(fu✘¶nction(){

       φ±;      &δ&± nbsp; navigator.device.captu×≈re.captureImage(captureSuccess, ‍✘ captureError,{limit:1})

    €←     &nb≈δεsp;   ≈≠♠♦; ;

     <✔÷©;    });

   &nbs €↕p; }

     δ&€;    captureSuccess ​↑•= function(mediaFile♦♦♥s){

     &nbs‌×¶±p;   &nb&₹sp;     <console.log("調用(yòng)攝像π 頭設備成功");

     &≈¶nbsp;   ©σα     for(var i=0;i&÷®$lt;mediaFiles.length;i++) {

      &< nbsp;    ​≈;      &n↓₩>→bsp; console.log("文(wén)件(jià→πα₹n)" + i);

    §✘"→     ∑★;   &↔¶¶<nbsp;    &n €∏≈bsp; console.log("n¶> ame--->" + mediaFiles[i].name);σ↔

    &nbs>→≈✘p;    ±λ     &nbs↓↕p;     ∏♠>console.log("fu>☆βllPath--->" + mediaFileγ<₽s[i].fullPath);

    & ←λ↑nbsp;    &§ ±nbsp;     &¥©•nbsp;   console.log("t↔γ₹ype--->" + me↓♣✔™diaFiles[i].type);

      &n→€bsp;  &nbs♥↔p;     &nb✘δsp;   console.log("lastππ←↑ModifiedDate--->" + m↑₩εediaFiles[i].lastModified↕™ Date);

     &★≤↓nbsp;     →©π‍;    &n₹π∏bsp;   console.log("siz÷​♥>e--->" + mediaFile∞ ≥s[i].size);

    &n€§εβbsp;   &n♥ ​bsp;   & ≈σ nbsp; }

    ♥↕     }

      &♠♥∞‌nbsp;  captureError=funct₩ ₽​ion(err){

     →↕;   &nbs←↕∞p;    ε≥≤; console.log("調用(<≥≈yòng)攝像頭設備失敗," + err);

     ÷σγ    }

</script>

</head>

<body>

     <div data≠☆₩€-role="page"≥σ←;>

      ₹←;   <div daλ£ta-role="header">

    &nb★←∑<sp;     ♠≤​§    <h1&g$✔Ω§t;Capture</h1>

   &nb≠α★∑sp;     </di© v>

     &nb©↕sp;   <div data-r∑$ole="content">

    &nλ∏$bsp;   &nbs£→"γp;     →‍σ✔<a id="btn_captureImage" h<λref="#" data-role="but∑₽Ωton">啓動攝像頭進行(xíng)拍(pāi)照(zhàoα•)</a>

    &$✔αnbsp;    </div>

      &n∑→₽bsp;  <div data-role=&≠•quot;footer">

----------------------- Page 5----✔→€∑-------------------

   &nπ •bsp;    &✘↓±nbsp;  &nbsσ≥γp;  <h4>&nbsp;&l♥∏±₽t;/h4>

    &n' "bsp;    &φ∞lt;/div>

     </div&‍₩gt;

</body>

</html>

四、capture.captureVideo  &nbsγδp;   &n"£​♥bsp;   &n↓γbsp;   ↓§ ™      捕獲視(shì•↓σ)屏

// 最多(duō)采集3個(gè)視(shì)頻(p∏​¥↔ín)剪輯

var options = { limit: 3​↕→ };

navigator.device.capture.capture✔πVideo(captureSuccess, caπ★ptureError, options);

MediaFile

 “封裝采集到(dào)的(de​↓↑)媒體(tǐ)文(wén)件(jiàn)的(de)屬性。

屬性:

    name:不(bù)含路(lù)徑信息的☆ (de)文(wén)件(jiàn)名。(DOMString 類ε&↑型)

    fullPath:包含文(wén)件(j©✔ iàn)名的(de)文(wén)件(ji↑®'∏àn)全路(lù)徑。(DOMString 類型)

    type:MIME 類型。♥±(DOMString 類型)

    lastM'&₽odifiedDate:文(wén)件(jiàn)最後修改​←的(de)日(rì)期和(hé)時(shí)間(jiān)。(日(&↕©πrì)期類型)

    size:以字節數≈Ωα¶(shù)表示的(de)文(wén)件(jiàn)大(dà)小<≥(xiǎo)。(數(shù)字類型)

<!DOCTYPE HTML>

<html>

<head>

<meta charset="utf-8">• 

<title>PhoneGap-Capture&l∞∞∑t;/title>

<link rel="stylesheet" hre←¥♠f="../jquery.mobile-1.1.1/j♦λ€query.mobile-1.1.1.css&q÷∑uot; />

<script src="δ♦../jquery.mobile-1.1.1/jquery.js"§ ¶λ;></script>

<script src="../jquery.mobil≥±"e-1.1.1/jquery.mobile-1.1.1.js"&∑✔gt;</script>

<script type="text/java₹₩script" charset=&•γ ↕quot;utf-8" src="../cordoπ≈$va-1.9.0.js"></script>↕¶φ;

<script type="text/j π☆avascript">

     $€♣(document).ready(function(){

     &nb≠πsp;    δ>♥    document.a©♥ ↕ddEventListener(&quo‍€t;deviceready", myDeviceRe>↔™adyListener, false);

     ​σ; });

     myDeviceReady✘★≠<Listener = function(){

----------------------- Page☆™Ω♥ 6-----------------------

     ∑ ;    $("♦♦#btn_captureVideo").cl↓↓£ick(function(){

    ∞λ; navigator.device.cap>¥©$ture.captureVideo(captur←ΩeSuccess,  captureErro‌•αr,{limit:1});

    <♣φ∏     });

     }

    &nb σ↓sp;    captu♣£reSuccess = function(media♦÷®™Files){

   &n→™→bsp;     ≠♣     console.l ♥←♣og("調用(yòng)攝像頭設備成功")™♥↕;

    &nb ↓₽sp;   &nbs÷α•®p;     for(var i★₽♥£=0;i<mediaFiles.length εΩ;i++) {

     ♦ε₹¶;     ™× ;     &n₹÷bsp;   console & .log("文(wén)件(jiàn)" ₽ ↕≥+ i);

   &nbs€≠‌≥p;    &n↕±≤∑bsp;   &nbsφ♥p;    &​¥∏nbsp; console.log("name--->&q ♥uot; + mediaFiles[i].name);

     &n↑∑λbsp;   ∑₹≈π;      &n™↓←λbsp;   console.log("↔α>βfullPath--->" + mediaFiles[i→±].fullPath);

   &nδ©bsp;    &n☆<§bsp;   ×βγ      •₽↕ console.log("typ♦®‌$e--->" + mediaFile∞↓s[i].type);

     ↑↓     &γαnbsp;     ↑×    console.log(&q×♠uot;lastModifiedDate--->" + med₹↔iaFiles[i].lastModifiedDate);

      &n≈<bsp;   ε ≠    &nb£∑≠sp;    console.log(&q•↔uot;size--->" + mediaFi♠$♠les[i].size);

     §✔£   &nb‍®sp;      ¥§;    mediaFiles‍☆[i].getFormatData(functioσ​©®n(fileData){

     &nλ∑λ bsp;     ¥×≠;     &n★φbsp;    © ;  console.log("codecs÷☆---->" + fileData.codecs$∞↕);

   &nbs×$≠ p;    &nbε≠sp;      ←♦;     &n¥♣bsp;  console.l≈λ¶og("bitrate--->" + file₩•♣Data.bitrate);

      &n↓♥ bsp;   &n>₹σbsp;     '​→;    &↓≠ nbsp;  console.log("h¥≥eight---->" + fil€↑←ΩeData.height);

   &nb¶σ♦sp;   &nbs₩δp;   ♣™    &n₽≤bsp;    &n©δ↕bsp;  console.log("width↓™™---->" + fileData.width);

    &&±≤γnbsp;    &nb☆×↑'sp;   β•     &  nbsp;   π®© console.log("duration---->£π∏" + fileData.durat™∑™Ωion);

     &₩↕ nbsp;    &✘±nbsp;     &nbs♥∞<p;  },function(err){

      &n≤δ®✘bsp;   &nbs₽​<€p;    ♣≥™Ω;   &nbs✘σ≤♣p;    ↓εφ console.log("獲取格式化(hu∑φà)信息失敗!" + err);

    £δ   &nbs↕♥p;    &n•πbsp;   ÷£®   });

   &n'₩∞bsp;     &↕↕♥nbsp;    }

      &δ±πγnbsp;  }

      <γ;   captureErr©δφ★or=function(err){

    ≠‍;      ₩✔π    console.lo£×∞g("調用(yòng)攝像頭設備失敗," + e≥±₽rr);

    &n♥→&₹bsp;    }

</script>

</head>

<body>

     <div dat÷←≤↓a-role="page&quo★ >t;>

      &n™γ∑•bsp;  <div data-role=∑$±"header">

      €✔‍;    &nbs§↑p;   <h1>Captuα★Ω>re</h1>

    &n≥•€₹bsp;    </div>

      &nb​π§sp;  <div data-role="cγ≈≠♠ontent">

   &nb €sp;    &✘$nbsp;    ±φ; <a id="btn_captureVideo±®" href="#" data-r​ ₹←ole="button">啓&↔"動攝像頭進行(xíng)攝像</a>

      • ♥>   </div>

     &nbs←®p;   <div'₽↔ data-role="foot®♦$er">

---------------------- γ×≠- Page 7-----------------------

      γ♥     ↑§ ;   <h4>&nbsp;< α&;/h4>

     &nbδ$sp;    &l¥∑∑'t;/div>

   &nbs×& ∏p; </div>

</body>

</html>

五、MediaFile.getFormatData¶♣←      Ω∑×;     &nbs↕'"p;   &n§‍‍≠bsp;     獲取媒體(✘₩tǐ)文(wén)件(jiàn)的(de)格式信息

MediaFileData

 “   &n↑'bsp;     γδ‌♣      ₽¶≠&;   &nb≠±sp;   封裝媒體(tǐ)文(wén)件(★ ×jiàn)的(de)格式信息。

屬性:

    codecs:音(yīn)頻(p ‍∞ín)及視(shì)頻(pín)內(nèi)容的(φ↓☆₹de)實際格式。(DOMString 類型♣€ε)

    bitrΩ®&ate:文(wén)件(jiàn)內(nèi)容的(de)平均比特率→☆。對(duì)于圖像文(wén)件(jiàn),屬性值為(wèi)0。(數(‍‌₹shù)字類型)

    height:用(yòn♣ ©g)像素表示的(de)圖像或視(shì)頻(pín)高(gāo)度×∏,音(yīn)頻(pín)剪輯的(de)該屬性值為('γ φwèi)0。(數(shù)字類型)

    width:δ><用(yòng)像素表示的(de)圖像或視(shì)頻λλ™(pín)的(de)寬度,音(yīn)頻(pín)剪輯的(de)該¥≠∞屬性值為(wèi)0。(數(shù)字類型)

    duration: 以≠•&®秒(miǎo)為(wèi)單位的(de)視(shì)頻(pín)或♣♥​音(yīn)頻(pín)剪輯時(shí)長(cháng),圖像文(wé↓$n)件(jiàn)的(de)該屬性值為(wèi)0。(±"數(shù)字類型)

<!DOCTYPE HTML>

<html>

<head>

<meta charset="u•₽tf-8">

<title>PhoneGa©©λp-Capture</title>

<link rel="stylesheet&γ↓÷¶quot; href="../jquery.mobile-1.1.1©>/jquery.mobile-1.1.1.→§σcss" />

<script src="../jquery₽✘π .mobile-1.1.1/jquery.js'φ"></script>

<script src="../jquery.mob£✔¶ile-1.1.1/jquery.mobile-1.1.1.js"&®€↑±gt;</script>

<script type="text/javascript&‍ ∞•quot; charset="utf-8"‍§β; src="../cordov↕✘a-1.9.0.js"></script&gσ≠∑t;

<script type="text/jaπβvascript">

 $(document).ready(function(){

     &n<≠↓©bsp;       ≥♣;     &∑‍nbsp;    γ$α;  document.addEventList&εener("deviceready",&Ω€nbsp;    ÷≥£;   myDeviceRead→ ↓'yListener,

false);

 });

 myDeviceReadyListener = fun₹ ction(){

   &n>↕'bsp;    ₩≈★    ≈ ↑'      ₽ ;    $("#btn_ca↓•★ptureVideo").click(function(≠€₩){

 navigator.device.captγΩure.captureVideo(captureSuccess, &δ₩™nbsp; captureError,{limit:1});

      &nβ&↔bsp;    &nb∏©♠©sp;      ↓¥↕✔    });

 }

---------------------"©>Ω-- Page 8-----------------------

      ↑↔♦;     &n¥Ωbsp;   &nb• '→sp;      capt÷λureSuccess = function(mediaF'≈iles){

     ♦"★φ    &n§♥π¥bsp;     &nbs♠±↔p;     ©γα∞   console.log(&'φ↑quot;調用(yòng)攝像頭設備成功"₹↕✔;);

   &nbs↓ p;    &n♠‍bsp;  &nbs​‍p;      &≤¥ε↕nbsp;   &n∏φ±bsp; for(var i=0;i<mediaFiles.φ&↔length;i++) {

     &nbs™÷→p;    λ₽ λ;   &nbs↕‌"p;   &nb>®sp;      ↕₽÷;     console.←♦log("文(wén)件(jiàn)" + &​Ωi);

     &nbπ¥sp;    &nb∑£≈sp;    &n™§bsp;   ±β♥     &©★αnbsp;  &nb♦$λεsp; console.log("name--->✘∏₩→;" + mediaFiles[i].name);

    &nb≥≤¥‍sp;   &n →§÷bsp;    Ω<;     &nb ε×sp;     &n≈‍εbsp;    console.α£≥δlog("fullPath--->"'♣±>; + mediaFiles[i].fullαελ​Path);

      &∏γδnbsp;    Ω     $< ;     ‌ Ω'    &nbα™★∏sp;    console.log₹"("type--->" + mediaF ↓iles[i].type);

    &nb§♣sp;   &n∞↓bsp;   &n↑₽λbsp;    &nb₩∞sp;      ÷★;     console.φ¶≤log("lastModifiππ∞™edDate--->" &n α¶ bsp;     φ‌≈←;    ✔↓    &®"&nbsp;   ↓∞$      ‌βΩ    &nbs≈<♣€p; +

mediaFiles[i].lastModifie​₩dDate);

     &nΩ∑bsp;      ¥≥¶;     &n™ €bsp;    &nbφ×sp;   ®±©;   console.log("s¶☆€✔ize--->" + mediaFilλ←∑✘es[i].size);

     &nbsφ<♣ p;     &n÷₹φ↑bsp;     ₽Ω    &≈•™ nbsp;     α<↔δ mediaFiles[i].getFormatData(function≤→×§(fileData){

   &nb♥≥☆sp;     & ₹$nbsp;   &n→♥♠bsp;    &n'α$≈bsp;      $☆;     πδ✔ ;   console.lπ€ og("codecs---->&q∑×γuot; + fileData.code≈±×cs);

      ¶φ∞γ;      ®∏↓←;    &nb∏±≤©sp;   π↑↕     &​∏≈nbsp;    &✘≠≠nbsp;   conso∏<↔÷le.log("bitrate--->" + ↔↑λ fileData.bitrate);

     &n∑★bsp;    ÷ ;   &nb★∞sp;   ​×∑;   &n®☆→βbsp;     &n±↑ bsp;      con<→≠sole.log("height----&±☆↑gt;" + fileData.h< >eight);

     &nb↑♦≈sp;    &←✔↕nbsp;   &₽γnbsp;    α ‌α;    'α;      ≤♠♠     co∏™¶<nsole.log("width---->" γ≈ε+ fileData.width);

      ®∏& ;    ✔λ;      &£₹nbsp;   &nbs™↔★αp;     ←∞±‌     &¶>≈nbsp; console.log("duration---π≥​←->" + fileData.du€αλ€ration);

     &nbsεεp;     ≤"∏'       ∞;   &nbs↑φ♦σp;    ₩∞;    },function(err){

   &nbsΩφp;     Ω¥;    •≥λδ    &± Ωnbsp;  &nb">®sp;   &Ωπ≤<nbsp;    &nb ☆≈∞sp;   console.log("&";獲取格式化(huà)信息失敗!" + err);

     &nbsγ♥•φp;   &‌φ♠≥nbsp;    &'‍δnbsp;     §"φ‍;    €Ω;    Ω  π; });

     &nbs$§p;      ε© •     &nb↕≤sp;    &☆≈nbsp; }

      &n★↑≥↓bsp;     &nbΩ♥±↑sp;     &₽↕☆♥nbsp;   }

      £♣;     &≥♦nbsp;    &nbπ÷♠sp;     captur✔ eError=function(err){

     ≠'✔☆   &nbs∞♠∏​p;     &nbs$$αp;   &★‌≥nbsp;     console.l ↑>og("調用(yòng)攝像頭設備失敗,"★↑Ω; + err);

      & ™βnbsp;   φπ∞     &n£≤‌bsp;   &<€   }

</script>

</head>

<body>

 <div data-role="page&q ✔→€uot;>

    &©♠©®nbsp;   ✘©"≠      &nb​φ™sp;     &nφ✘→bsp; <div data-role="h£±±‌eader">

      &n ≠★bsp;   &nbs‍∑ >p;    &n™ bsp;   &nb♦₹sp;    <h1>©®;Capture</h1>

     ↕ ‍∏;     &n✘®♣≈bsp;     &nb'©sp;     <∑∑€;/div>

      &$≥¥nbsp;    βΩ;      ♣&¶;     <di♦♦≥v data-role="content&☆•βquot;>

   &n‍♦±≥bsp;    &n©✘ ✘bsp;      ↑    ®<;      <a★÷ id="btn_capture∏<♥Video" href="#" data-$∏©€role="button">啓動攝γ₽$☆像頭進行(xíng)攝

像</a>

    &← δnbsp;   &nb₹↓'αsp;    &nb&σsp;     &nbs♣≤♥​p;  </div>

      &↓★nbsp;    &nbs±Ωλ©p;      →<;    <div dφβ​ata-role="footer"&g ✔t;

    &n♠Ω∞bsp;    >↓¥;     ←φ     &n♣π‍←bsp;    <h4>₩λ₩≤&nbsp;</h4>

      π↓↑±   &nb ☆∏sp;   &nbs↕φ×p;     δ♦;    &≈≠♣lt;/div>

 </div>

----------------------- Pag§÷e 9-----------------←¥------

</body>

</html>