Lisa testing pulling in plugins for plugin: cordova-plugin-media
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/commit/10f54381 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/tree/10f54381 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/diff/10f54381 Branch: refs/heads/master Commit: 10f5438146963e8c94eddf69cf626567b80ab06a Parents: 2e21ded Author: ldeluca <[email protected]> Authored: Tue May 27 17:49:47 2014 -0400 Committer: ldeluca <[email protected]> Committed: Tue May 27 17:49:47 2014 -0400 ---------------------------------------------------------------------- doc/ja/index.md | 488 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 488 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/10f54381/doc/ja/index.md ---------------------------------------------------------------------- diff --git a/doc/ja/index.md b/doc/ja/index.md new file mode 100644 index 0000000..5b74c1c --- /dev/null +++ b/doc/ja/index.md @@ -0,0 +1,488 @@ +<!--- + 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. +--> + +# org.apache.cordova.media + +This plugin provides the ability to record and play back audio files on a device. + +**注**: ç¾å¨ã®å®è£ ã§ã¯ãã¡ãã£ã¢ã®ãã£ããã£ã®ããã® W3C 仿§ã«æºæ ãã¦ããªãã¨ã¯ä¾¿å®ä¸æä¾ãããã ãã§ãã å°æ¥ã®å®è£ ãææ°ã® W3C 仿§ã«æºæ ããç¾å¨ Api ãã¨ããããã¨ãããã¾ãã + +## ã¤ã³ã¹ãã¼ã« + + cordova plugin add org.apache.cordova.media + + +## ãµãã¼ãããã¦ãããã©ãããã©ã¼ã + +* ã¢ã³ããã¤ã +* ãã©ãã¯ããªã¼ 10 +* iOS +* Windows Phone 7 㨠8 +* Tizen +* Windows 8 + +## Windows Phone ã®ç + +* ã®ã¿ 1 ã¤ã®ã¡ãã£ã¢ ãã¡ã¤ã«ã¯ãä¸åº¦ã«åçã§ãã¾ãã + +* ã¢ããªã±ã¼ã·ã§ã³ã¨ä»ã®ã¡ãã£ã¢ã¨ã®å¯¾è©±ã«å³æ ¼ãªå¶éãããã¾ãã [詳細ã«ã¤ãã¦ã¯ãMicrosoft ã®ããã¥ã¢ã«][1]ãåç §ãã¦ãã ããã. + + [1]: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh184838(v=vs.92).aspx + +## ã¡ãã£ã¢ + + var media = new Media(src, mediaSuccess, [mediaError], [mediaStatus]); + + +### ãã©ã¡ã¼ã¿ã¼ + +* **src**: ãªã¼ãã£ãªã®ã³ã³ãã³ããå«ã URIã*ï¼ï¼ï¼* + +* **mediaSuccess**: (çç¥å¯è½) å¾ã«å®è¡ããã³ã¼ã«ããã¯ã `Media` åçç¨ã«ç¾å¨ãã¬ã³ã¼ããã¾ã㯠stop ã¢ã¯ã·ã§ã³ ãªãã¸ã§ã¯ããå®äºãã¾ããã*(æ©è½)* + +* **mediaError**: (çç¥å¯è½) ã¨ã©ã¼ãçºçããå ´åã«å®è¡ãããã³ã¼ã«ããã¯ã*(æ©è½)* + +* **mediaStatus**: (çç¥å¯è½) ç¶æ ã®å¤åã示ãããã«å®è¡ãããã³ã¼ã«ããã¯ã*(æ©è½)* + +### 宿° + +次ã®å®æ°ãå¯ä¸ã®ãã©ã¡ã¼ã¿ã¼ã¨ãã¦å ±åããã¾ãã `mediaStatus` ã³ã¼ã«ããã¯ã + +* `Media.MEDIA_NONE` = 0; +* `Media.MEDIA_STARTING` = 1; +* `Media.MEDIA_RUNNING` = 2; +* `Media.MEDIA_PAUSED` = 3; +* `Media.MEDIA_STOPPED` = 4; + +### ã¡ã½ãã + +* `media.getCurrentPosition`: ãªã¼ãã£ãª ãã¡ã¤ã«å ã®ç¾å¨ä½ç½®ãè¿ãã¾ãã + +* `media.getDuration`: ãªã¼ãã£ãª ãã¡ã¤ã«ã®ç¶ç¶æéãè¿ãã¾ãã + +* `media.play`: éå§ã¾ãã¯ãªã¼ãã£ãª ãã¡ã¤ã«ã®åçãåéãã¾ãã + +* `media.pause`ï¼ ãªã¼ãã£ãª ãã¡ã¤ã«ã®åçã䏿忢ã + +* `media.release`: åºã«ãªããªãã¬ã¼ãã£ã³ã° ã·ã¹ãã ã®ãªã¼ãã£ãª ãªã½ã¼ã¹ãè§£æ¾ãã¾ãã + +* `media.seekTo`: ãªã¼ãã£ãª ãã¡ã¤ã«å ã®ä½ç½®ãç§»åãã¾ãã + +* `media.setVolume`: ãªã¼ãã£ãªã®åçããªã¥ã¼ã ãè¨å®ãã¾ãã + +* `media.startRecord`ï¼ ãªã¼ãã£ãª ãã¡ã¤ã«ã®é²é³ãéå§ãã¾ãã + +* `media.stopRecord`: ãªã¼ãã£ãª ãã¡ã¤ã«ã®é²é³ã忢ãã¾ãã + +* `media.stop`: ãªã¼ãã£ãª ãã¡ã¤ã«ã®åçã忢ãã¾ãã + +### 追å èªã¿åãå°ç¨ãã©ã¡ã¼ã¿ã¼ + +* **ä½ç½®**ï¼ æ°ç§ã§ãªã¼ãã£ãªã®åçã§ã¯ãå ã®ä½ç½®ã + + * èªåçã«æ´æ°ããã¾ãã; ã®ãã¬ã¤ä¸ã«ã³ã¼ã« `getCurrentPosition` ãæ´æ°ãã¾ãã + +* **æé**: ç§ã§ãã¡ãã£ã¢ã®æéã + +## media.getCurrentPosition + +Returns the current position within an audio file. Also updates the `Media` object's `position` parameter. + + media.getCurrentPosition(mediaSuccess, [mediaError]); + + +### ãã©ã¡ã¼ã¿ã¼ + +* **mediaSuccess**: ç§ã®ç¾å¨ã®ä½ç½®ã渡ãããã³ã¼ã«ããã¯ã + +* **mediaError**: (çç¥å¯è½) ã³ã¼ã«ããã¯ã§ã¨ã©ã¼ãçºçããå ´åã«å®è¡ãã¾ãã + +### ç°¡åãªä¾ + + // Audio player + // + var my_media = new Media(src, onSuccess, onError); + + // Update media position every second + var mediaTimer = setInterval(function () { + // get media position + my_media.getCurrentPosition( + // success callback + function (position) { + if (position > -1) { + console.log((position) + " sec"); + } + }, + // error callback + function (e) { + console.log("Error getting pos=" + e); + } + ); + }, 1000); + + +## media.getDuration + +Returns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1. + + media.getDuration(); + + +### ç°¡åãªä¾ + + // Audio player + // + var my_media = new Media(src, onSuccess, onError); + + // Get duration + var counter = 0; + var timerDur = setInterval(function() { + counter = counter + 100; + if (counter > 2000) { + clearInterval(timerDur); + } + var dur = my_media.getDuration(); + if (dur > 0) { + clearInterval(timerDur); + document.getElementById('audio_duration').innerHTML = (dur) + " sec"; + } + }, 100); + + +## media.pause + +ãªã¼ãã£ãª ãã¡ã¤ã«ã®åçã䏿忢ãã¾ãã + + media.pause(); + + +### ç°¡åãªä¾ + + // Play audio + // + function playAudio(url) { + // Play the audio file at url + var my_media = new Media(url, + // success callback + function () { console.log("playAudio():Audio Success"); }, + // error callback + function (err) { console.log("playAudio():Audio Error: " + err); } + ); + + // Play audio + my_media.play(); + + // Pause after 10 seconds + setTimeout(function () { + media.pause(); + }, 10000); + } + + +## media.play + +éå§ã¾ãã¯ãªã¼ãã£ãª ãã¡ã¤ã«ã®åçãåéãã¾ãã + + media.play(); + + +### ç°¡åãªä¾ + + // Play audio + // + function playAudio(url) { + // Play the audio file at url + var my_media = new Media(url, + // success callback + function () { + console.log("playAudio():Audio Success"); + }, + // error callback + function (err) { + console.log("playAudio():Audio Error: " + err); + } + ); + // Play audio + my_media.play(); + } + + +### iOS ã®ç + +* **numberOfLoops**: ãã®ãªãã·ã§ã³ãæå®ãã¦ã `play` ã¡ãã£ã¢ ãã¡ã¤ã«ãåçãããä¾ãã°åæ°ãæå®ããæ¹æ³ã + + var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") + myMedia.play({ numberOfLoops: 2 }) + + +* **playAudioWhenScreenIsLocked**: ãã®ãªãã·ã§ã³ã渡ãã `play` ãç»é¢ãããã¯ããã¦ããã¨ãã«åçã許å¯ãããã©ãããæå®ããã¡ã½ããã å ´åã«è¨å®ããã¦ãã `true` (æ¢å®å¤)ãä¾ãã°ããã¼ãã¦ã§ã¢ ãã¥ã¼ã ãã¿ã³ã®ç¶æ ã¯ç¡è¦ããã¾ãã + + var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") + myMedia.play({ playAudioWhenScreenIsLocked : false }) + + +* **ãã¡ã¤ã«æ¤ç´¢ã®é åº**: iOS ã®æ¤ç´¢ã§ãã¡ã¤ã«åã¾ãã¯åç´ãªãã¹ã®ã¿ãæä¾ãããå ´åã `www` ãã£ã¬ã¯ããªããã¡ã¤ã«ãã¢ããªã±ã¼ã·ã§ã³ã® `documents/tmp` ãã£ã¬ã¯ããªã + + var myMedia = new Media("audio/beer.mp3") + myMedia.play() // first looks for file in www/audio/beer.mp3 then in <application>/documents/tmp/audio/beer.mp3 + + +## media.release + +åºã«ãªããªãã¬ã¼ãã£ã³ã° ã·ã¹ãã ã®ãªã¼ãã£ãª ãªã½ã¼ã¹ãè§£æ¾ãã¾ãã This is particularly important for Android, since there are a finite amount of OpenCore instances for media playback. ã¢ããªã±ã¼ã·ã§ã³ãå¼ã³åºãå¿ è¦ãããã¾ãã `release` ä»»æã®é¢æ° `Media` ã¯ããã¯ãå¿ è¦ãªãªã½ã¼ã¹ã§ãã + + media.release(); + + +### ç°¡åãªä¾ + + // Audio player + // + var my_media = new Media(src, onSuccess, onError); + + my_media.play(); + my_media.stop(); + my_media.release(); + + +## media.seekTo + +ãªã¼ãã£ãª ãã¡ã¤ã«å ã®ç¾å¨ä½ç½®ãè¨å®ãã¾ãã + + media.seekTo(milliseconds); + + +### ãã©ã¡ã¼ã¿ã¼ + +* **ããªç§åä½**ï¼ ããªç§åä½ã§ããªã¼ãã£ãªã®åçä½ç½®ãè¨å®ããä½ç½®ã + +### ç°¡åãªä¾ + + // Audio player + // + var my_media = new Media(src, onSuccess, onError); + my_media.play(); + // SeekTo to 10 seconds after 5 seconds + setTimeout(function() { + my_media.seekTo(10000); + }, 5000); + + +### ãã©ãã¯ããªã¼ 10 ç + +* ãã©ãã¯ããªã¼ OS 5 ããã¤ã¹ã§ãµãã¼ãããã¦ãã¾ããã + +## media.setVolume + +ãªã¼ãã£ãª ãã¡ã¤ã«ã®é³éãè¨å®ãã¾ãã + + media.setVolume(volume); + + +### ãã©ã¡ã¼ã¿ã¼ + +* **ããªã¥ã¼ã **: ããªã¥ã¼ã ã®åçãè¨å®ãã¾ããå¤ã¯ 0.0 ï½ 1.0 ã®ç¯å²å ã§ããå¿ è¦ãããã¾ãã + +### ãµãã¼ãããã¦ãããã©ãããã©ã¼ã + +* ã¢ã³ããã¤ã +* iOS + +### ç°¡åãªä¾ + + // Play audio + // + function playAudio(url) { + // Play the audio file at url + var my_media = new Media(url, + // success callback + function() { + console.log("playAudio():Audio Success"); + }, + // error callback + function(err) { + console.log("playAudio():Audio Error: "+err); + }); + + // Play audio + my_media.play(); + + // Mute volume after 2 seconds + setTimeout(function() { + my_media.setVolume('0.0'); + }, 2000); + + // Set volume to 1.0 after 5 seconds + setTimeout(function() { + my_media.setVolume('1.0'); + }, 5000); + } + + +## media.startRecord + +ãªã¼ãã£ãª ãã¡ã¤ã«ã®é²é³ãéå§ãã¾ãã + + media.startRecord(); + + +### ãµãã¼ãããã¦ãããã©ãããã©ã¼ã + +* ã¢ã³ããã¤ã +* iOS +* Windows Phone 7 㨠8 +* Windows 8 + +### ç°¡åãªä¾ + + // Record audio + // + function recordAudio() { + var src = "myrecording.mp3"; + var mediaRec = new Media(src, + // success callback + function() { + console.log("recordAudio():Audio Success"); + }, + + // error callback + function(err) { + console.log("recordAudio():Audio Error: "+ err.code); + }); + + // Record audio + mediaRec.startRecord(); + } + + +### Android ã®ç + +* Android 端æ«é©å¿åãã«ãã¬ã¼ãå½¢å¼ã«ãªã¼ãã£ãªãé²é³ãã¾ããæå®ãããã¡ã¤ã«ã¯ã *.amr*æ¡å¼µåã§çµããå¿ è¦ãããã¾ãã + +### iOS ã®ç + +* iOS ã®ç¨®é¡*.wav*ã¨è¿ãã¾ãã¨ã©ã¼å ´åã¯ããã¡ã¤ã«åæ¡å¼µåããã¡ã¤ã«ãã¬ã³ã¼ãã®ã¿ãä¿®æ£ããã¾ããã + +* è¨é²ã¯ãã¢ããªã±ã¼ã·ã§ã³ã®é ç½®ã®å®å ¨ãªãã¹ãæå®ããªãå ´å `documents/tmp` ãã£ã¬ã¯ããªã ãããä»ãã¦ã¢ã¯ã»ã¹ãããã¨ãã§ãã¾ãã `File` API ã使ç¨ã㦠`LocalFileSystem.TEMPORARY` ã è¨é²æã«æå®ãããä»»æã®ãµããã£ã¬ã¯ããªã«åå¨ããå¿ è¦ãããã¾ãã + +* ãã¡ã¤ã«ãè¨é²ããåçãããã¨ãã§ãã¾ãããã¥ã¡ã³ã URI ã使ç¨ãã¦ã + + var myMedia = new Media("documents://beer.mp3") + + +### Tizen ã®ç + +* Tizen ã®ããã¤ã¹ã§ãµãã¼ãããã¦ãã¾ããã + +## media.stop + +ãªã¼ãã£ãª ãã¡ã¤ã«ã®åçã忢ãã¾ãã + + media.stop(); + + +### ç°¡åãªä¾ + + // Play audio + // + function playAudio(url) { + // Play the audio file at url + var my_media = new Media(url, + // success callback + function() { + console.log("playAudio():Audio Success"); + }, + // error callback + function(err) { + console.log("playAudio():Audio Error: "+err); + } + ); + + // Play audio + my_media.play(); + + // Pause after 10 seconds + setTimeout(function() { + my_media.stop(); + }, 10000); + } + + +## media.stopRecord + +ãªã¼ãã£ãª ãã¡ã¤ã«ã®é²é³ã忢ãã¾ãã + + media.stopRecord(); + + +### ãµãã¼ãããã¦ãããã©ãããã©ã¼ã + +* ã¢ã³ããã¤ã +* iOS +* Windows Phone 7 㨠8 +* Windows 8 + +### ç°¡åãªä¾ + + // Record audio + // + function recordAudio() { + var src = "myrecording.mp3"; + var mediaRec = new Media(src, + // success callback + function() { + console.log("recordAudio():Audio Success"); + }, + + // error callback + function(err) { + console.log("recordAudio():Audio Error: "+ err.code); + } + ); + + // Record audio + mediaRec.startRecord(); + + // Stop recording after 10 seconds + setTimeout(function() { + mediaRec.stopRecord(); + }, 10000); + } + + +### Tizen ã®ç + +* Tizen ã®ããã¤ã¹ã§ãµãã¼ãããã¦ãã¾ããã + +## MediaError + +A `MediaError` ãªãã¸ã§ã¯ãã«è¿ãããã `mediaError` ã³ã¼ã«ããã¯é¢æ°ã§ã¨ã©ã¼ãçºçããã¨ãã + +### ãããã㣠+ +* **ã³ã¼ã**: 次ã®ããããã®å®ç¾©æ¸ã¿ã®ã¨ã©ã¼ ã³ã¼ãã + +* **ã¡ãã»ã¼ã¸**: ã¨ã©ã¼ã®è©³ç´°ã説æããã¨ã©ã¼ ã¡ãã»ã¼ã¸ã + +### 宿° + +* `MediaError.MEDIA_ERR_ABORTED` +* `MediaError.MEDIA_ERR_NETWORK` +* `MediaError.MEDIA_ERR_DECODE` +* `MediaError.MEDIA_ERR_NONE_SUPPORTED` \ No newline at end of file
