diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-10-31 08:21:38 -0400 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-10-31 08:21:38 -0400 |
| commit | 02811010cf62f1b21a06780d1e470d04bb24c50f (patch) | |
| tree | 0d933789068aac11c810ed4bb169d14ab16c43c6 /plugins/org.apache.cordova.media/doc | |
| parent | bca561c1b3989d62a1fba829e0380c6fbf36caf5 (diff) | |
removed unecessary files from git
Diffstat (limited to 'plugins/org.apache.cordova.media/doc')
| -rw-r--r-- | plugins/org.apache.cordova.media/doc/de/index.md | 494 | ||||
| -rw-r--r-- | plugins/org.apache.cordova.media/doc/es/index.md | 494 | ||||
| -rw-r--r-- | plugins/org.apache.cordova.media/doc/fr/index.md | 494 | ||||
| -rw-r--r-- | plugins/org.apache.cordova.media/doc/index.md | 508 | ||||
| -rw-r--r-- | plugins/org.apache.cordova.media/doc/it/index.md | 494 | ||||
| -rw-r--r-- | plugins/org.apache.cordova.media/doc/ja/index.md | 494 | ||||
| -rw-r--r-- | plugins/org.apache.cordova.media/doc/ko/index.md | 494 | ||||
| -rw-r--r-- | plugins/org.apache.cordova.media/doc/pl/index.md | 494 | ||||
| -rw-r--r-- | plugins/org.apache.cordova.media/doc/ru/index.md | 494 | ||||
| -rw-r--r-- | plugins/org.apache.cordova.media/doc/zh/index.md | 494 |
10 files changed, 0 insertions, 4954 deletions
diff --git a/plugins/org.apache.cordova.media/doc/de/index.md b/plugins/org.apache.cordova.media/doc/de/index.md deleted file mode 100644 index e3e6cd73..00000000 --- a/plugins/org.apache.cordova.media/doc/de/index.md +++ /dev/null @@ -1,494 +0,0 @@ -<!--- - 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 - -Dieses Plugin bietet die Möglichkeit zum Aufzeichnen und Wiedergeben von audio-Dateien auf einem Gerät. - -**Hinweis**: die aktuelle Implementierung eine W3C-Spezifikation für Medien-Capture nicht einhalten, und wird nur zu Informationszwecken zur Verfügung gestellt. Zukünftiger Implementierungen wird an der aktuellen W3C-Spezifikation und kann die aktuellen APIs entweiht. - -## Installation - - cordova plugin add org.apache.cordova.media - - -## Unterstützte Plattformen - -* Android -* BlackBerry 10 -* iOS -* Windows Phone 7 und 8 -* Tizen -* Windows 8 - -## Windows Phone Macken - -* Nur eine Mediendatei kann gleichzeitig abgespielt werden. - -* Es gibt strenge Beschränkungen, wie Ihre Anwendung mit anderen Medien interagiert. Finden Sie in der [Microsoft-Dokumentation für details][1]. - - [1]: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh184838(v=vs.92).aspx - -## Medien - - var media = new Media(src, mediaSuccess, [mediaError], [mediaStatus]); - - -### Parameter - -* **Src**: ein URI mit der audio-Inhalte. *(DOM-String und enthält)* - -* **MediaSuccess**: (Optional) der Rückruf, der nach dem führt ein `Media` -Objekt abgeschlossen hat, die aktuelle Wiedergabe, Aufzeichnung oder Stop-Action. *(Funktion)* - -* **Medienfehler**: (Optional) der Rückruf, der ausgeführt wird, wenn ein Fehler auftritt. *(Funktion)* - -* **MediaStatus**: (Optional) der Rückruf, der ausgeführt wird, um Statusänderungen anzugeben. *(Funktion)* - -### Konstanten - -Die folgenden Konstanten werden gemeldet, als einzigem Parameter an die `mediaStatus` Rückruf: - -* `Media.MEDIA_NONE`= 0; -* `Media.MEDIA_STARTING`= 1; -* `Media.MEDIA_RUNNING`= 2; -* `Media.MEDIA_PAUSED`= 3; -* `Media.MEDIA_STOPPED`= 4; - -### Methoden - -* `media.getCurrentPosition`: Gibt die aktuelle Position in einer Audiodatei. - -* `media.getDuration`: Gibt die Dauer einer Audiodatei. - -* `media.play`: Starten Sie oder fortsetzen Sie der Wiedergabe einer Audiodatei. - -* `media.pause`: Anhalten der Wiedergabe einer Audiodatei. - -* `media.release`: Das zugrunde liegende Betriebssystem audio Ressourcen frei. - -* `media.seekTo`: Verschiebt die Position innerhalb der audio-Datei. - -* `media.setVolume`: Stellen Sie die Lautstärke für die Audiowiedergabe. - -* `media.startRecord`: Starten der Aufnahme einer audio-Datei. - -* `media.stopRecord`: Stoppen Sie die Aufnahme einer audio-Datei. - -* `media.stop`: Abspielen einer Audiodatei zu stoppen. - -### Zusätzliche ReadOnly-Parameter - -* **Position**: die Position innerhalb der audio-Wiedergabe in Sekunden. - - * Nicht während des Spiels automatisch aktualisiert; Rufen Sie `getCurrentPosition` zu aktualisieren. - -* **Dauer**: die Dauer der Medien, in Sekunden. - -## media.getCurrentPosition - -Gibt die aktuelle Position in einer Audiodatei. Aktualisiert auch die `Media` des Objekts `position` Parameter. - - media.getCurrentPosition(mediaSuccess, [mediaError]); - - -### Parameter - -* **MediaSuccess**: der Rückruf, der die aktuelle Position in Sekunden übergeben wird. - -* **Medienfehler**: (Optional) der Rückruf ausgeführt, wenn ein Fehler auftritt. - -### Kurzes Beispiel - - // 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 - -Gibt die Dauer einer Audiodatei in Sekunden. Wenn die Dauer unbekannt ist, wird der Wert-1 zurückgegeben. - - media.getDuration(); - - -### Kurzes Beispiel - - // 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 - -Pausen Abspielen einer Audiodatei. - - media.pause(); - - -### Kurzes Beispiel - - // 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 - -Startet oder setzt fort, Abspielen einer Audiodatei. - - media.play(); - - -### Kurzes Beispiel - - // 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 Macken - -* **NumberOfLoops**: übergeben Sie diese Option, um die `play` -Methode können Sie die Anzahl der angeben soll die Mediendatei ausspielen, z.B.: - - var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") - myMedia.play({ numberOfLoops: 2 }) - - -* **PlayAudioWhenScreenIsLocked**: übergeben Sie diese Option, um die `play` -Methode können Sie angeben, ob Sie möchten Wiedergabe zu ermöglichen, wenn der Bildschirm gesperrt ist. Wenn legen Sie auf `true` (der Standardwert), der Zustand der die mute Taste wird ignoriert, z.B.: - - var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") - myMedia.play({ playAudioWhenScreenIsLocked : false }) - - -* **Reihenfolge der Dateisuche**: Wenn nur ein Dateiname oder Pfad angegeben wird, sucht iOS in das `www` Verzeichnis für die Datei, dann in der Anwendung `documents/tmp` Verzeichnis: - - 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 - -Das zugrunde liegende Betriebssystem audio Ressourcen frei. Dies ist besonders wichtig für Android, da gibt es eine begrenzte Anzahl von OpenCore-Instanzen für die Medienwiedergabe. Anwendungen rufen die `release` -Funktion für alle `Media` Ressource, die nicht mehr benötigt wird. - - media.release(); - - -### Kurzes Beispiel - - // Audio player - // - var my_media = new Media(src, onSuccess, onError); - - my_media.play(); - my_media.stop(); - my_media.release(); - - -## media.seekTo - -Legt die aktuelle Position in einer Audiodatei. - - media.seekTo(milliseconds); - - -### Parameter - -* **Millisekunden**: die Position die Wiedergabeposition innerhalb des Audiotracks in Millisekunden festgelegt. - -### Kurzes Beispiel - - // 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); - - -### BlackBerry 10 Macken - -* BlackBerry OS 5-Geräten unterstützt nicht. - -## media.setVolume - -Stellen Sie die Lautstärke für eine audio-Datei. - - media.setVolume(volume); - - -### Parameter - -* **Lautstärke**: die Lautstärke für Wiedergabe fest. Der Wert muss im Bereich zwischen 0,0 und 1,0 liegen. - -### Unterstützte Plattformen - -* Android -* iOS - -### Kurzes Beispiel - - // 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 - -Beginnt mit der Aufnahme einer audio-Datei. - - media.startRecord(); - - -### Unterstützte Plattformen - -* Android -* iOS -* Windows Phone 7 und 8 -* Windows 8 - -### Kurzes Beispiel - - // 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 Eigenarten - -* Android-Geräte aufnehmen Audio im Adaptive Sprachcodecs Format. Die angegebene Datei sollte mit einer Endung *.amr* enden. - -### iOS Macken - -* iOS nur Datensätze, die Dateien des Typs *WAV* und gibt ein Fehler, wenn die Dateinamen-Erweiterung ist richtig nicht. - -* Wenn ein vollständiger Pfad nicht angegeben ist, wird die Aufzeichnung in der Anwendung platziert `documents/tmp` Verzeichnis. Erreichbar über die `File` -API verwenden `LocalFileSystem.TEMPORARY` . Allen Unterverzeichnissen in Rekordzeit angegeben muss bereits vorhanden sein. - -* Dateien können aufgezeichnet und spielte mit die Dokumenten URI zurück: - - var myMedia = new Media("documents://beer.mp3") - - -### Windows 8 Macken - -* Wenn Sie ein vollständiger Pfad nicht angegeben ist, wird die Aufnahme im AppData/Temp-Verzeichnis platziert. Erreichbar über die `Datei` API verwenden `LocalFileSystem.TEMPORARY` oder "ms-Appdata: / / / Temp /<filename>' URI. - -* Allen Unterverzeichnissen in Rekordzeit angegeben muss bereits vorhanden sein. - -### Tizen Macken - -* Tizen Geräten unterstützt nicht. - -## media.stop - -Beendet die Wiedergabe einer Audiodatei. - - Media.Stop(); - - -### Kurzes Beispiel - - // 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 - -Stoppt die Aufnahme einer audio-Datei. - - media.stopRecord(); - - -### Unterstützte Plattformen - -* Android -* iOS -* Windows Phone 7 und 8 -* Windows 8 - -### Kurzes Beispiel - - // 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 Macken - -* Tizen Geräten unterstützt nicht. - -## Medienfehler - -A `MediaError` Objekt wird zurückgegeben, um die `mediaError` Callback-Funktion, wenn ein Fehler auftritt. - -### Eigenschaften - -* **Code**: einer der vordefinierten Fehlercodes aufgeführt. - -* **Nachricht**: eine Fehlermeldung beschreibt die Details des Fehlers. - -### Konstanten - -* `MediaError.MEDIA_ERR_ABORTED`= 1 -* `MediaError.MEDIA_ERR_NETWORK`= 2 -* `MediaError.MEDIA_ERR_DECODE`= 3 -* `MediaError.MEDIA_ERR_NONE_SUPPORTED`= 4
\ No newline at end of file diff --git a/plugins/org.apache.cordova.media/doc/es/index.md b/plugins/org.apache.cordova.media/doc/es/index.md deleted file mode 100644 index ce5d8dd0..00000000 --- a/plugins/org.apache.cordova.media/doc/es/index.md +++ /dev/null @@ -1,494 +0,0 @@ -<!--- - 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 - -Este plugin proporciona la capacidad de grabar y reproducir archivos de audio en un dispositivo. - -**Nota**: la implementación actual no se adhiere a una especificación del W3C para la captura de los medios de comunicación y se proporciona únicamente para su comodidad. Una futura implementación se adherirá a la más reciente especificación W3C y puede desaprueban las API actuales. - -## Instalación - - cordova plugin add org.apache.cordova.media - - -## Plataformas soportadas - -* Android -* BlackBerry 10 -* iOS -* Windows Phone 7 y 8 -* Tizen -* Windows 8 - -## Windows Phone rarezas - -* Archivo único multimedia puede reproducir en un momento. - -* Hay restricciones estrictas sobre cómo interactúa la aplicación con otros medios. Consulte la [documentación de Microsoft para obtener más detalles][1]. - - [1]: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh184838(v=vs.92).aspx - -## Los medios de comunicación - - var media = new Media(src, mediaSuccess, [mediaError], [mediaStatus]); - - -### Parámetros - -* **src**: un URI que contiene el contenido de audio. *(DOMString)* - -* **mediaSuccess**: (opcional) la devolución de llamada que se ejecuta después de que un objeto `Media` ha completado el juego actual, registro o acción. *(Function)* - -* **mediaError**: (opcional) la devolución de llamada que se ejecuta si se produce un error. *(Función)* - -* **mediaStatus**: (opcional) la devolución de llamada que se ejecuta para indicar cambios en el estado. *(Función)* - -### Constantes - -Las siguientes constantes son reportadas como el único parámetro para la devolución de llamada `mediaStatus`: - -* `Media.MEDIA_NONE` = 0; -* `Media.MEDIA_STARTING` = 1; -* `Media.MEDIA_RUNNING` = 2; -* `Media.MEDIA_PAUSED` = 3; -* `Media.MEDIA_STOPPED` = 4; - -### Métodos - -* `media.getCurrentPosition`: devuelve la posición actual dentro de un archivo de audio. - -* `media.getDuration`: devuelve la duración de un archivo de audio. - -* `media.play`: iniciar o reanudar reproducción de un archivo de audio. - -* `media.pause`: pausar la reproducción de un archivo de audio. - -* `media.release`: libera recursos de audio del sistema operativo subyacente. - -* `media.seekTo`: mueve la posición dentro del archivo de audio. - -* `media.setVolume`: ajuste el volumen de reproducción de audio. - -* `media.startRecord`: iniciar la grabación de un archivo de audio. - -* `media.stopRecord`: dejar de grabar un archivo de audio. - -* `media.stop`: deja de jugar a un archivo de audio. - -### Parámetros adicionales ReadOnly - -* **posición**: la posición dentro de la reproducción de audio, en segundos. - - * No actualizada automáticamente durante la reproducción; Llame a `getCurrentPosition` para actualizar. - -* **duration**: la duración de los medios de comunicación, en segundos. - -## media.getCurrentPosition - -Devuelve la posición actual dentro de un archivo de audio. También actualiza el `Media` del objeto `position` parámetro. - - media.getCurrentPosition(mediaSuccess, [mediaError]); - - -### Parámetros - -* **mediaSuccess**: la devolución de llamada que se pasa a la posición actual en segundos. - -* **mediaError**: (opcional) la devolución de llamada para ejecutar si se produce un error. - -### Ejemplo rápido - - // 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 - -Devuelve la duración de un archivo de audio en segundos. Si se desconoce la duración, devuelve un valor de -1. - - media.getDuration(); - - -### Ejemplo rápido - - // 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 - -Pausas jugando un archivo de audio. - - media.pause(); - - -### Ejemplo rápido - - // 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 - -Inicia o reanuda la reproducción de un archivo de audio. - - media.play(); - - -### Ejemplo rápido - - // 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 rarezas - -* **numberOfLoops**: pasar esta opción al método `play` para especificar el número de veces que desea que los medios de archivo para jugar, por ejemplo: - - var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") - myMedia.play({ numberOfLoops: 2 }) - - -* **playAudioWhenScreenIsLocked**: pasar en esta opción el método `play` para especificar si desea permitir la reproducción cuando la pantalla está bloqueada. Si se omite establecido en `true` (el valor predeterminado), el estado del botón mute hardware, por ejemplo: - - var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") - myMedia.play({ playAudioWhenScreenIsLocked : false }) - - -* **orden de búsqueda de archivos**: cuando se proporciona sólo un nombre de archivo o ruta simple, iOS busca en el directorio `www` para el archivo, luego en el directorio de la aplicación `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 - -Libera los recursos de audio del sistema operativo subyacente. Esto es particularmente importante para Android, ya que hay una cantidad finita de instancias de OpenCore para la reproducción multimedia. Las aplicaciones deben llamar a la función de `release` para cualquier recurso `Media` que ya no es necesario. - - media.release(); - - -### Ejemplo rápido - - // Audio player - // - var my_media = new Media(src, onSuccess, onError); - - my_media.play(); - my_media.stop(); - my_media.release(); - - -## media.seekTo - -Establece la posición actual dentro de un archivo de audio. - - media.seekTo(milliseconds); - - -### Parámetros - -* **milliseconds**: la posición para ajustar la posición de reproducción en el audio, en milisegundos. - -### Ejemplo rápido - - // 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); - - -### BlackBerry 10 rarezas - -* No compatible con dispositivos BlackBerry OS 5. - -## media.setVolume - -Ajustar el volumen para un archivo de audio. - - media.setVolume(volume); - - -### Parámetros - -* **volume**: el volumen para la reproducción. El valor debe estar dentro del rango de 0.0 a 1.0. - -### Plataformas soportadas - -* Android -* iOS - -### Ejemplo rápido - - // 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 - -Empieza a grabar un archivo de audio. - - media.startRecord(); - - -### Plataformas soportadas - -* Android -* iOS -* Windows Phone 7 y 8 -* Windows 8 - -### Ejemplo rápido - - // 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(); - } - - -### Rarezas Android - -* Dispositivos Android grabación audio en formato Adaptive Multi-rate. El archivo especificado debe terminar con una extensión de *.amr*. - -### iOS rarezas - -* iOS únicos registros a archivos de tipo *.wav* y devuelve un error si el archivo de extensión el nombre es no es correcto. - -* Si no se proporciona una ruta completa, la grabación se coloca en el directorio de la aplicación `documents/tmp`. Esto se puede acceder mediante el `File` API utilizando `LocalFileSystem.TEMPORARY`. Ya debe existir cualquier subdirectorio especificado en un tiempo récord. - -* Archivos pueden ser grabados y jugó de nuevo usando los documentos URI: - - var myMedia = new Media("documents://beer.mp3") - - -### Rarezas de Windows 8 - -* Si no se proporciona una ruta completa, la grabación se coloca en el directorio AppData/temp. Esto puede accederse a través de la `Archivo` Usando API `LocalFileSystem.TEMPORARY` o ' ms-appdata: temporal / / / /<filename>' URI. - -* Ya debe existir cualquier subdirectorio especificado en un tiempo récord. - -### Rarezas Tizen - -* No compatible con dispositivos Tizen. - -## media.stop - -Deja de jugar a un archivo de audio. - - media.stop(); - - -### Ejemplo rápido - - // 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 - -Detiene la grabación de un archivo de audio. - - media.stopRecord(); - - -### Plataformas soportadas - -* Android -* iOS -* Windows Phone 7 y 8 -* Windows 8 - -### Ejemplo rápido - - // 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); - } - - -### Rarezas Tizen - -* No compatible con dispositivos Tizen. - -## MediaError - -A `MediaError` objeto es devuelto a la `mediaError` función de devolución de llamada cuando se produce un error. - -### Propiedades - -* **code**: uno de los códigos de error predefinido enumerados a continuación. - -* **mensaje**: un mensaje de error que describe los detalles del error. - -### Constantes - -* `MediaError.MEDIA_ERR_ABORTED`= 1 -* `MediaError.MEDIA_ERR_NETWORK`= 2 -* `MediaError.MEDIA_ERR_DECODE`= 3 -* `MediaError.MEDIA_ERR_NONE_SUPPORTED`= 4
\ No newline at end of file diff --git a/plugins/org.apache.cordova.media/doc/fr/index.md b/plugins/org.apache.cordova.media/doc/fr/index.md deleted file mode 100644 index 291c13b1..00000000 --- a/plugins/org.apache.cordova.media/doc/fr/index.md +++ /dev/null @@ -1,494 +0,0 @@ -<!--- - 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 - -Ce plugin permet d'enregistrer et de lire des fichiers audio sur un périphérique. - -**Remarque**: l'implémentation actuelle n'est pas conforme à une spécification du W3C pour la capture de médias et est fournie pour plus de commodité seulement. Une prochaine implémentation adhèrera à la toute dernière spécification du W3C, ce qui aura probablement pour effet de déprécier l'API actuelle. - -## Installation - - cordova plugin add org.apache.cordova.media - - -## Plates-formes prises en charge - -* Android -* BlackBerry 10 -* iOS -* Windows Phone 7 et 8 -* Paciarelli -* Windows 8 - -## Windows Phone Quirks - -* Un seul fichier média peut être lu à la fois. - -* Il y a des restrictions strictes concernant la façon dont votre application interagit avec d'autres médias. Consultez la [documentation de Microsoft pour plus d'informations][1]. - - [1]: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh184838(v=vs.92).aspx - -## Media - - var media = new Media(src, mediaSuccess, [mediaError], [mediaStatus]); - - -### Paramètres - -* **src** : l'URI du contenu audio. *(DOMString)* - -* **mediaSuccess** : (facultative) la fonction callback exécutée après que la lecture en cours, l'action d'enregistrement ou l'arrêt de lecture de l'objet `Media` soit terminée. *(Function)* - -* **mediaError** : (facultative) la fonction callback exécutée si une erreur survient. *(Function)* - -* **mediaStatus** : (facultative) la fonction callback exécutée lors de chaque changement d'état. *(Function)* - -### Constantes - -Les constantes suivantes correspondent au seul paramètre transmis à la fonction callback `mediaStatus` : - -* `Media.MEDIA_NONE` = 0; -* `Media.MEDIA_STARTING` = 1; -* `Media.MEDIA_RUNNING` = 2; -* `Media.MEDIA_PAUSED` = 3; -* `Media.MEDIA_STOPPED` = 4; - -### Méthodes - -* `media.getCurrentPosition` : retourne la position de lecture dans un fichier audio. - -* `media.getDuration`: retourne la durée d'un fichier audio. - -* `media.play` : permet de commencer ou reprendre la lecture d'un fichier audio. - -* `media.pause` : interrompt la lecture d'un fichier audio. - -* `media.release` : libère les ressources audio correspondantes du système d'exploitation. - -* `media.seekTo` : déplace la position de lecture au sein du fichier audio. - -* `media.setVolume` : permet de régler le volume du clip audio. - -* `media.startRecord` : commence l'enregistrement d'un fichier audio. - -* `media.stopRecord` : arrête l'enregistrement d'un fichier audio. - -* `media.stop` : arrête la lecture d'un fichier audio. - -### Paramètres supplémentaires en lecture seule - -* **position** : la position de lecture sein du clip audio, en secondes. - - * La valeur n'est pas automatiquement rafraichie pendant la lecture ; un appel à `getCurrentPosition` permet sa mise à jour. - -* **duration** : la durée du média, en secondes. - -## media.getCurrentPosition - -Retourne la position courante dans un fichier audio. Met également à jour la `Media` de l'objet `position` paramètre. - - media.getCurrentPosition(mediaSuccess, [mediaError]); - - -### Paramètres - -* **mediaSuccess** : la fonction callback à laquelle est transmise la position actuelle exprimée en secondes. - -* **mediaError** : (facultative) la fonction callback exécutée si une erreur se produit. - -### Petit exemple - - // lecteur audio - // - var my_media = new Media(src, onSuccess, onError); - - // met à jour la position de lecture du fichier à chaque seconde - var mediaTimer = setInterval(function () { - // récupère la position - my_media.getCurrentPosition( - // fonction callback de succès - function (position) { - if (position > -1) { - console.log((position) + " secondes"); - } - }, - // fonction callback d'erreur - function (e) { - console.log("Erreur lors de l'obtention de la position : " + e); - } - ); - }, 1000); - - -## media.getDuration - -Retourne la durée d'un fichier audio en quelques secondes. Si on ne connaît pas la durée, elle retourne la valeur -1. - - media.getDuration(); - - -### Petit exemple - - // lecteur audio - // - var my_media = new Media(src, onSuccess, onError); - - // récupère la durée - 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) + " secondes"; - } - }, 100); - - -## media.pause - -Suspend la lecture d'un fichier audio. - - media.pause(); - - -### Petit exemple - - // joue le clip audio - // - function playAudio(url) { - // joue le fichier audio situé à cette url - var my_media = new Media(url, - // fonction callback de succès - function () { console.log("playAudio() : clip audio joué avec succès"); }, - // error callback - function (err) { console.log("playAudio() : erreur lors de la lecture du clip audio: " + err); } - ); - - // lance la lecture du clip audio - my_media.play(); - - // met la lecture en pause après 10 secondes - setTimeout(function () { - media.pause(); - }, 10000); - } - - -## media.play - -Commence ou reprend la lecture d'un fichier audio. - - media.play(); - - -### Petit exemple - - // joue le clip audio - // - function playAudio(url) { - // joue le fichier audio situé à cette url - var my_media = new Media(url, - // fonction callback de succès - function () { - console.log("playAudio() : fichier audio lu avec succès"); - }, - // fonction callback d'erreur - function (err) { - console.log("playAudio() : erreur lors de la lecture du fichier audio : " + err); - } - ); - // commence la lecture du clip audio - my_media.play(); - } - - -### iOS Quirks - -* **numberOfLoops** : transmettre cette option à la méthode `play` permet de spécifier le nombre de lectures à la suite d'un fichier donné, par exemple : - - var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") - myMedia.play({ numberOfLoops: 2 }) - - -* **playAudioWhenScreenIsLocked** : transmettre cette option à la méthode `play` permet de spécifier si la lecture doit continuer même lorsque l'écran de l'appareil est verrouillé. Si la valeur est `true` (par défaut), le bouton matériel mute est ignoré, par exemple : - - var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") - myMedia.play({ playAudioWhenScreenIsLocked : false }) - - -* **ordre de recherche de fichier** : si un nom de fichier ou chemin d'accès simple est fourni, iOS recherche d'abord le fichier correspondant dans le répertoire `www`, puis dans le répertoire `documents/tmp` appartenant à l'application : - - var myMedia = new Media("audio/beer.mp3") - myMedia.play() // recherche d'abord le fichier www/audio/beer.mp3 puis <application>/documents/tmp/audio/beer.mp3 - - -## media.release - -Libère certaines ressources audio du système d'exploitation. Cela est particulièrement important pour Android, puisqu'il y a une quantité finie d'instances OpenCore pour la lecture du média. Les applications doivent en général appeler cette fonction `release` pour toute ressource `Media` qui n'est plus nécessaire. - - media.release(); - - -### Petit exemple - - // lecteur audio - // - var my_media = new Media(src, onSuccess, onError); - - my_media.play(); - my_media.stop(); - my_media.release(); - - -## media.seekTo - -Définit la position de lecture actuelle dans un fichier audio. - - media.seekTo(milliseconds); - - -### Paramètres - -* **milliseconds** : la nouvelle position de lecture au sein du fichier audio, en millisecondes. - -### Petit exemple - - // lecteur audio - // - var my_media = new Media(src, onSuccess, onError); - my_media.play(); - // avance la position à 10 secondes du début du fichier après 5 secondes - setTimeout(function() { - my_media.seekTo(10000); - }, 5000); - - -### BlackBerry 10 Quirks - -* Cette méthode n'est pas prise en charge sur les périphériques BlackBerry OS 5. - -## media.setVolume - -Permet de régler le volume d'un fichier audio. - - media.setVolume(volume); - - -### Paramètres - -* **volume** : le volume à utiliser pour la lecture. La valeur doit être comprise entre 0.0 et 1.0 inclus. - -### Plates-formes prises en charge - -* Android -* iOS - -### Petit exemple - - // joue le clip audio - // - function playAudio(url) { - // joue le fichier audio situé à cette url - var my_media = new Media(url, - // fonction callback de succès - function() { - console.log("playAudio() : fichier audio lu avec succès"); - }, - // fonction callback d'erreur - function(err) { - console.log("playAudio() : erreur lors de la lecture du fichier audio : " + err); - }); - - // lance la lecture du clip audio - my_media.play(); - - // baisse le volume au maximum après 2 secondes - setTimeout(function() { - my_media.setVolume('0.0'); - }, 2000); - - // monte le volume à 1.0 (maximum) après 5 secondes - setTimeout(function() { - my_media.setVolume('1.0'); - }, 5000); - } - - -## media.startRecord - -Permet de démarrer l'enregistrement d'un fichier audio. - - media.startRecord(); - - -### Plates-formes prises en charge - -* Android -* iOS -* Windows Phone 7 et 8 -* Windows 8 - -### Petit exemple - - // enregistrement audio - // - function recordAudio() { - var src = "myrecording.mp3"; - var mediaRec = new Media(src, - // fonction callback de succès - function() { - console.log("recordAudio() : audio enregistré avec succès"); - }, - - // fonction callback d'erreur - function(err) { - console.log("recordAudio() : erreur lors de l'enregistrement audio : " + err.code); - }); - - // débute l'enregistrement audio - mediaRec.startRecord(); - } - - -### Quirks Android - -* Les appareils Android enregistrent de l'audio au format Adaptive Multi-Rate. Le nom de fichier spécifié doit donc comporter une extension *.amr*. - -### iOS Quirks - -* iOS produit uniquement des enregistrements sous la forme de fichier de type *.wav* et renvoie une erreur si l'extension du nom de fichier est incorrecte. - -* Si un chemin d'accès complet n'est pas précisé, l'enregistrement est placé dans le répertoire `documents/tmp` correspondant à l'application. Il sera ensuite accessible via l'API `File` en utilisant la constante `LocalFileSystem.TEMPORARY`. Tout sous-répertoire présent dans le chemin d'accès au moment de l'enregistrement doit déjà exister. - -* Les fichiers peuvent être enregistrés et lus à l'aide de l'URI des documents : - - var myMedia = new Media("documents://beer.mp3") - - -### Bizarreries de Windows 8 - -* Si un chemin d'accès complet n'est pas fourni, l'enregistrement est placé dans le répertoire AppData/temp. Ce qui peut être consulté le `Fichier` À l'aide de l'API `LocalFileSystem.TEMPORARY` ou ' ms-appdata : temp / / / /<filename>' URI. - -* N'importe quel sous-répertoire spécifié au moment de l'enregistrement doit déjà exister. - -### Bizarreries de paciarelli - -* Pas pris en charge sur les appareils paciarelli. - -## media.stop - -Arrête la lecture d'un fichier audio. - - media.stop(); - - -### Petit exemple - - // joue le clip audio - // - function playAudio(url) { - // joue le fichier audio situé à cette url - var my_media = new Media(url, - // fonction callback de succès - function() { - console.log("playAudio() : clip audio lu avec succès"); - }, - // fonction callback d'erreur - function(err) { - console.log("playAudio() : erreur lors de la lecture du clip audio : " + err); - } - ); - - // démarre la lecture du clip audio - my_media.play(); - - // arrête la lecture après 10 secondes - setTimeout(function() { - my_media.stop(); - }, 10000); - } - - -## media.stopRecord - -Arrête l'enregistrement d'un fichier audio. - - media.stopRecord(); - - -### Plates-formes prises en charge - -* Android -* iOS -* Windows Phone 7 et 8 -* Windows 8 - -### Petit exemple - - // enregistrement audio - // - function recordAudio() { - var src = "myrecording.mp3"; - var mediaRec = new Media(src, - // fonction callback de succès - function() { - console.log("recordAudio() : audio enregistré avec succès"); - }, - - // fonction callback d'erreur - function(err) { - console.log("recordAudio() : erreur lors de l'enregistrement audio : " + err.code); - } - ); - - // débute l'enregistrement audio - mediaRec.startRecord(); - - // arrête l'enregistrement après 10 secondes - setTimeout(function() { - mediaRec.stopRecord(); - }, 10000); - } - - -### Bizarreries de paciarelli - -* Pas pris en charge sur les appareils paciarelli. - -## MediaError - -Un objet `MediaError` est transmis à la fonction callback `mediaError` lorsqu'une erreur survient. - -### Propriétés - -* **code**: l'un des codes d'erreur prédéfinis énumérés ci-dessous. - -* **message**: un message d'erreur décrivant les détails de l'erreur. - -### Constantes - -* `MediaError.MEDIA_ERR_ABORTED`= 1 -* `MediaError.MEDIA_ERR_NETWORK`= 2 -* `MediaError.MEDIA_ERR_DECODE`= 3 -* `MediaError.MEDIA_ERR_NONE_SUPPORTED`= 4
\ No newline at end of file diff --git a/plugins/org.apache.cordova.media/doc/index.md b/plugins/org.apache.cordova.media/doc/index.md deleted file mode 100644 index 297d1e72..00000000 --- a/plugins/org.apache.cordova.media/doc/index.md +++ /dev/null @@ -1,508 +0,0 @@ -<!--- - 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. - -__NOTE__: The current implementation does not adhere to a W3C -specification for media capture, and is provided for convenience only. -A future implementation will adhere to the latest W3C specification -and may deprecate the current APIs. - -This plugin defines a global `Media` Constructor. - -Although in the global scope, it is not available until after the `deviceready` event. - - document.addEventListener("deviceready", onDeviceReady, false); - function onDeviceReady() { - console.log(Media); - } - -## Installation - - cordova plugin add org.apache.cordova.media - -## Supported Platforms - -- Android -- BlackBerry 10 -- iOS -- Windows Phone 7 and 8 -- Tizen -- Windows 8 - -## Windows Phone Quirks - -- Only one media file can be played back at a time. - -- There are strict restrictions on how your application interacts with other media. See the [Microsoft documentation for details][url]. - -[url]: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh184838(v=vs.92).aspx - -## Media - - var media = new Media(src, mediaSuccess, [mediaError], [mediaStatus]); - -### Parameters - -- __src__: A URI containing the audio content. _(DOMString)_ - -- __mediaSuccess__: (Optional) The callback that executes after a `Media` object has completed the current play, record, or stop action. _(Function)_ - -- __mediaError__: (Optional) The callback that executes if an error occurs. _(Function)_ - -- __mediaStatus__: (Optional) The callback that executes to indicate status changes. _(Function)_ - -### Constants - -The following constants are reported as the only parameter to the -`mediaStatus` callback: - -- `Media.MEDIA_NONE` = 0; -- `Media.MEDIA_STARTING` = 1; -- `Media.MEDIA_RUNNING` = 2; -- `Media.MEDIA_PAUSED` = 3; -- `Media.MEDIA_STOPPED` = 4; - -### Methods - -- `media.getCurrentPosition`: Returns the current position within an audio file. - -- `media.getDuration`: Returns the duration of an audio file. - -- `media.play`: Start or resume playing an audio file. - -- `media.pause`: Pause playback of an audio file. - -- `media.release`: Releases the underlying operating system's audio resources. - -- `media.seekTo`: Moves the position within the audio file. - -- `media.setVolume`: Set the volume for audio playback. - -- `media.startRecord`: Start recording an audio file. - -- `media.stopRecord`: Stop recording an audio file. - -- `media.stop`: Stop playing an audio file. - -### Additional ReadOnly Parameters - -- __position__: The position within the audio playback, in seconds. - - Not automatically updated during play; call `getCurrentPosition` to update. - -- __duration__: The duration of the media, in seconds. - - -## media.getCurrentPosition - -Returns the current position within an audio file. Also updates the `Media` object's `position` parameter. - - media.getCurrentPosition(mediaSuccess, [mediaError]); - -### Parameters - -- __mediaSuccess__: The callback that is passed the current position in seconds. - -- __mediaError__: (Optional) The callback to execute if an error occurs. - -### Quick Example - - // 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(); - -### Quick Example - - // 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 - -Pauses playing an audio file. - - media.pause(); - - -### Quick Example - - // 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 - -Starts or resumes playing an audio file. - - media.play(); - - -### Quick Example - - // 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 Quirks - -- __numberOfLoops__: Pass this option to the `play` method to specify - the number of times you want the media file to play, e.g.: - - var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") - myMedia.play({ numberOfLoops: 2 }) - -- __playAudioWhenScreenIsLocked__: Pass in this option to the `play` - method to specify whether you want to allow playback when the screen - is locked. If set to `true` (the default value), the state of the - hardware mute button is ignored, e.g.: - - var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") - myMedia.play({ playAudioWhenScreenIsLocked : false }) - -- __order of file search__: When only a file name or simple path is - provided, iOS searches in the `www` directory for the file, then in - the application's `documents/tmp` directory: - - 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 - -Releases the underlying operating system's audio resources. -This is particularly important for Android, since there are a finite amount of -OpenCore instances for media playback. Applications should call the `release` -function for any `Media` resource that is no longer needed. - - media.release(); - - -### Quick Example - - // Audio player - // - var my_media = new Media(src, onSuccess, onError); - - my_media.play(); - my_media.stop(); - my_media.release(); - - -## media.seekTo - -Sets the current position within an audio file. - - media.seekTo(milliseconds); - -### Parameters - -- __milliseconds__: The position to set the playback position within the audio, in milliseconds. - - -### Quick Example - - // 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); - - -### BlackBerry 10 Quirks - -- Not supported on BlackBerry OS 5 devices. - -## media.setVolume - -Set the volume for an audio file. - - media.setVolume(volume); - -### Parameters - -- __volume__: The volume to set for playback. The value must be within the range of 0.0 to 1.0. - -### Supported Platforms - -- Android -- iOS - -### Quick Example - - // 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 - -Starts recording an audio file. - - media.startRecord(); - -### Supported Platforms - -- Android -- iOS -- Windows Phone 7 and 8 -- Windows 8 - -### Quick Example - - // 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 Quirks - -- Android devices record audio in Adaptive Multi-Rate format. The specified file should end with a _.amr_ extension. -- The hardware volume controls are wired up to the media volume while any Media objects are alive. Once the last created Media object has `release()` called on it, the volume controls revert to their default behaviour. The controls are also reset on page navigation, as this releases all Media objects. - -### iOS Quirks - -- iOS only records to files of type _.wav_ and returns an error if the file name extension is not correct. - -- If a full path is not provided, the recording is placed in the application's `documents/tmp` directory. This can be accessed via the `File` API using `LocalFileSystem.TEMPORARY`. Any subdirectory specified at record time must already exist. - -- Files can be recorded and played back using the documents URI: - - var myMedia = new Media("documents://beer.mp3") - -### Windows 8 Quirks - -- If a full path is not provided, the recording is placed in the AppData/temp directory. This can be accessed via the `File` API using `LocalFileSystem.TEMPORARY` or 'ms-appdata:///temp/<filename>' URI. - -- Any subdirectory specified at record time must already exist. - -### Tizen Quirks - -- Not supported on Tizen devices. - -## media.stop - -Stops playing an audio file. - - media.stop(); - -### Quick Example - - // 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 - -Stops recording an audio file. - - media.stopRecord(); - -### Supported Platforms - -- Android -- iOS -- Windows Phone 7 and 8 -- Windows 8 - -### Quick Example - - // 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 Quirks - -- Not supported on Tizen devices. - -## MediaError - -A `MediaError` object is returned to the `mediaError` callback -function when an error occurs. - -### Properties - -- __code__: One of the predefined error codes listed below. - -- __message__: An error message describing the details of the error. - -### Constants - -- `MediaError.MEDIA_ERR_ABORTED` = 1 -- `MediaError.MEDIA_ERR_NETWORK` = 2 -- `MediaError.MEDIA_ERR_DECODE` = 3 -- `MediaError.MEDIA_ERR_NONE_SUPPORTED` = 4 - diff --git a/plugins/org.apache.cordova.media/doc/it/index.md b/plugins/org.apache.cordova.media/doc/it/index.md deleted file mode 100644 index 50da3aaf..00000000 --- a/plugins/org.apache.cordova.media/doc/it/index.md +++ /dev/null @@ -1,494 +0,0 @@ -<!--- - 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 - -Questo plugin consente di registrare e riprodurre i file audio su un dispositivo. - -**Nota**: l'implementazione attuale non aderisce a una specifica del W3C per l'acquisizione di mezzi e viene fornito solo per comodità. Una futura realizzazione aderirà alla specifica W3C più recente e può deprecare le API corrente. - -## Installazione - - cordova plugin add org.apache.cordova.media - - -## Piattaforme supportate - -* Android -* BlackBerry 10 -* iOS -* Windows Phone 7 e 8 -* Tizen -* Windows 8 - -## Stranezze di Windows Phone - -* File sola multimediale può essere riprodotti in un momento. - -* Ci sono severe restrizioni su come l'applicazione interagisce con altri media. Vedere la [documentazione di Microsoft per maggiori dettagli][1]. - - [1]: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh184838(v=vs.92).aspx - -## Media - - var media = new Media(src, mediaSuccess, [mediaError], [mediaStatus]); - - -### Parametri - -* **src**: un URI contenente il contenuto audio. *(DOMString)* - -* **mediaSuccess**: (facoltativo) il callback che viene eseguito dopo un `Media` oggetto ha completato il gioco corrente, record o interrompere l'azione. *(Funzione)* - -* **errore mediaError**: (facoltativo) il callback che viene eseguito se si verifica un errore. *(Funzione)* - -* **mediaStatus**: (facoltativo) il callback che viene eseguito per indicare i cambiamenti di stato. *(Funzione)* - -### Costanti - -Costanti sono segnalate come unico parametro per il `mediaStatus` callback: - -* `Media.MEDIA_NONE` = 0; -* `Media.MEDIA_STARTING` = 1; -* `Media.MEDIA_RUNNING` = 2; -* `Media.MEDIA_PAUSED` = 3; -* `Media.MEDIA_STOPPED` = 4; - -### Metodi - -* `media.getCurrentPosition`: Restituisce la posizione corrente all'interno di un file audio. - -* `media.getDuration`: Restituisce la durata di un file audio. - -* `media.play`: Iniziare o riprendere la riproduzione di un file audio. - -* `media.pause`: Pausa la riproduzione di un file audio. - -* `media.release`: Libera risorse audio del sistema operativo sottostante. - -* `media.seekTo`: Sposta la posizione all'interno del file audio. - -* `media.setVolume`: Impostare il volume per la riproduzione audio. - -* `media.startRecord`: Iniziare a registrare un file audio. - -* `media.stopRecord`: Interrompere la registrazione di un file audio. - -* `media.stop`: Interrompere la riproduzione di un file audio. - -### Parametri supplementari ReadOnly - -* **posizione**: la posizione all'interno della riproduzione audio, in pochi secondi. - - * Non aggiornate automaticamente durante il gioco; chiamare `getCurrentPosition` per l'aggiornamento. - -* **durata**: la durata dei media, in secondi. - -## media.getCurrentPosition - -Restituisce la posizione corrente all'interno di un file audio. Aggiorna anche il `Media` dell'oggetto `position` parametro. - - media.getCurrentPosition(mediaSuccess, [mediaError]); - - -### Parametri - -* **mediaSuccess**: il callback passato la posizione corrente in pochi secondi. - -* **errore mediaError**: (facoltativo) il callback da eseguire se si verifica un errore. - -### Esempio rapido - - // 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 - -Restituisce la durata di un file audio in secondi. Se la durata è sconosciuta, essa restituisce un valore di -1. - - media.getDuration(); - - -### Esempio rapido - - // 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 - -Sospende la riproduzione di un file audio. - - media.pause(); - - -### Esempio rapido - - // 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 - -Avvia o riprende la riproduzione di un file audio. - - media.play(); - - -### Esempio rapido - - // 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 stranezze - -* **numberOfLoops**: passare questa opzione per il `play` metodo per specificare il numero di volte desiderato file multimediale per riprodurre, ad esempio: - - var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") - myMedia.play({ numberOfLoops: 2 }) - - -* **playAudioWhenScreenIsLocked**: questa opzione per passare il `play` metodo per specificare se si desidera consentire la riproduzione quando lo schermo è bloccato. Se impostato su `true` (il valore predefinito), viene ignorato lo stato del pulsante mute hardware, ad esempio: - - var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") - myMedia.play({ playAudioWhenScreenIsLocked : false }) - - -* **ordine di ricerca di file**: quando viene fornito solo un nome file o percorso semplice, cerca in iOS il `www` directory per il file, quindi l'applicazione `documents/tmp` directory: - - 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 - -Rilascia le risorse audio del sistema operativo sottostante. Ciò è particolarmente importante per Android, dato che ci sono una quantità finita di OpenCore istanze per la riproduzione multimediale. Le applicazioni devono chiamare il `release` funzione per qualsiasi `Media` risorsa che non è più necessario. - - media.release(); - - -### Esempio rapido - - // Audio player - // - var my_media = new Media(src, onSuccess, onError); - - my_media.play(); - my_media.stop(); - my_media.release(); - - -## media.seekTo - -Imposta la posizione corrente all'interno di un file audio. - - media.seekTo(milliseconds); - - -### Parametri - -* **millisecondi**: posizione per impostare la posizione di riproduzione all'interno l'audio, in millisecondi. - -### Esempio rapido - - // 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); - - -### BlackBerry 10 capricci - -* Non è supportato sui dispositivi BlackBerry OS 5. - -## media.setVolume - -Impostare il volume per un file audio. - - media.setVolume(volume); - - -### Parametri - -* **volume**: il volume impostato per la riproduzione. Il valore deve essere all'interno della gamma di 0,0 e 1,0. - -### Piattaforme supportate - -* Android -* iOS - -### Esempio rapido - - // 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 - -Avvia la registrazione di un file audio. - - media.startRecord(); - - -### Piattaforme supportate - -* Android -* iOS -* Windows Phone 7 e 8 -* Windows 8 - -### Esempio rapido - - // 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(); - } - - -### Stranezze Android - -* Dispositivi Android registrano audio in formato Adaptive Multi-Rate. Il file specificato deve terminare con l'estensione ** . - -### iOS stranezze - -* iOS solo i record per i file di tipo *WAV* e restituisce un errore se il file di nome estensione è non corretto. - -* Se non è specificato un percorso completo, la registrazione viene inserita nell'applicazione `documents/tmp` directory. Questo si può accedere tramite il `File` API utilizzando `LocalFileSystem.TEMPORARY` . Deve esistere alcuna sottodirectory specificate a tempo di record. - -* I file possono essere registrati e giocati indietro usando i documenti URI: - - var myMedia = new Media("documents://beer.mp3") - - -### Stranezze di Windows 8 - -* Se non è specificato un percorso completo, la registrazione viene inserita nella directory AppData/temp. Questo si può accedere tramite il `File` Utilizzando API `LocalFileSystem.TEMPORARY` o ' ms-appdata: / / temp /<filename>' URI. - -* Deve esistere alcuna sottodirectory specificate a tempo di record. - -### Tizen stranezze - -* Tizen periferiche non supportano. - -## media.stop - -Interrompe la riproduzione di un file audio. - - Media.Stop(); - - -### Esempio rapido - - // 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 - -Smette di registrare un file audio. - - media.stopRecord(); - - -### Piattaforme supportate - -* Android -* iOS -* Windows Phone 7 e 8 -* Windows 8 - -### Esempio rapido - - // 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 stranezze - -* Tizen periferiche non supportano. - -## Errore MediaError - -A `MediaError` oggetto viene restituito alla `mediaError` funzione di callback quando si verifica un errore. - -### Proprietà - -* **codice**: uno dei codici di errore predefiniti elencati di seguito. - -* **messaggio**: un messaggio di errore che descrive i dettagli dell'errore. - -### Costanti - -* `MediaError.MEDIA_ERR_ABORTED`= 1 -* `MediaError.MEDIA_ERR_NETWORK`= 2 -* `MediaError.MEDIA_ERR_DECODE`= 3 -* `MediaError.MEDIA_ERR_NONE_SUPPORTED`= 4
\ No newline at end of file diff --git a/plugins/org.apache.cordova.media/doc/ja/index.md b/plugins/org.apache.cordova.media/doc/ja/index.md deleted file mode 100644 index 29c63e6d..00000000 --- a/plugins/org.apache.cordova.media/doc/ja/index.md +++ /dev/null @@ -1,494 +0,0 @@ -<!--- - 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 - -このプラグインは、記録し、デバイス上のオーディオ ファイルを再生する機能を提供します。 - -**注**: 現在の実装では、メディアのキャプチャのための 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 - -オーディオ ファイル内の現在位置を返します。また更新して、 `Media` オブジェクトの `position` パラメーター。 - - 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 - -オーディオ ファイルの継続時間 (秒単位) を返します。期間は知られている、-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 - -基になるオペレーティング システムのオーディオ リソースを解放します。 メディアの再生のための OpenCore インスタンスの有限な量があるので、人造人間のため特に重要です。 アプリケーションを呼び出す必要があります、 `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") - - -### Windows 8 の癖 - -* 完全なパスを指定しない場合、記録は AppData/temp ディレクトリに配置されます。これを介してアクセスすることができます、 `ファイル` API を使用してください。 `LocalFileSystem.TEMPORARY` または ' ms appdata: temp////<filename>' URI。 - -* 記録時に指定された任意のサブディレクトリに存在する必要があります。 - -### 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`= 1 -* `MediaError.MEDIA_ERR_NETWORK`= 2 -* `MediaError.MEDIA_ERR_DECODE`= 3 -* `MediaError.MEDIA_ERR_NONE_SUPPORTED`= 4
\ No newline at end of file diff --git a/plugins/org.apache.cordova.media/doc/ko/index.md b/plugins/org.apache.cordova.media/doc/ko/index.md deleted file mode 100644 index 3a7a908c..00000000 --- a/plugins/org.apache.cordova.media/doc/ko/index.md +++ /dev/null @@ -1,494 +0,0 @@ -<!--- - 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 - -이 플러그인 기록 장치에 오디오 파일을 재생 하는 기능을 제공 합니다. - -**참고**: 현재 구현 미디어 캡처에 대 한 W3C 사양을 준수 하지 않는 및 편의 위해서만 제공 됩니다. 미래 구현 최신 W3C 사양을 준수 한다 고 현재 Api 사용 중지 될 수 있습니다. - -## 설치 - - cordova plugin add org.apache.cordova.media - - -## 지원 되는 플랫폼 - -* 안 드 로이드 -* 블랙베리 10 -* iOS -* Windows Phone 7과 8 -* Tizen -* 윈도우 8 - -## Windows Phone 단점 - -* 한 번에 하나의 미디어 파일을 다시 재생할 수 있습니다. - -* 응용 프로그램 다른 미디어와 상호 작용 하는 방법에 대 한 엄격한 제한이 있다. [자세한 내용은 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. *(DOMString)* - -* **mediaSuccess**: (선택 사항) 후 실행 되는 콜백 한 `Media` 개체 현재 재생, 기록, 또는 중지 작업을 완료 했습니다. *(기능)* - -* **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 - -오디오 파일 내에서 현재 위치를 반환합니다. 또한 업데이트는 `Media` 개체의 `position` 매개 변수. - - 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 - -초 오디오 파일의 기간을 반환합니다. 기간을 알 수 없는 경우-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 - -기본 운영 체제의 오디오 리소스를 해제합니다. 이것은 유한 양의 미디어 재생용 OpenCore 인스턴스 때문에 안 드 로이드를 위해 특히 중요 하다입니다. 응용 프로그램 호출 해야는 `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 -* 윈도우 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(); - } - - -### 안 드 로이드 단점 - -* 안 드 로이드 장치 적응 다중 속도 형식에서 오디오를 기록합니다. 지정 된 파일 *.amr* 확장명으로 끝나야 합니다. - -### iOS 단점 - -* iOS만 레코드 형식을 *.wav* 및 반환 오류 경우 파일 이름 확장명의 파일을 수정 하지. - -* 전체 경로 제공 하지 않으면 응용 프로그램의 기록 배치 됩니다 `documents/tmp` 디렉터리. 이 통해 액세스할 수 있는 `File` API를 사용 하 여 `LocalFileSystem.TEMPORARY` . 기록 시간에 지정 된 하위 디렉터리에 이미 존재 해야 합니다. - -* 파일을 기록 하 고 재생할 수 있습니다 문서 URI를 사용 하 여 다시: - - var myMedia = new Media("documents://beer.mp3") - - -### 윈도우 8 단점 - -* 전체 경로 제공 하지 않으면 녹음 AppData/temp 디렉터리에 배치 됩니다. 이 통해 액세스할 수 있는 `파일` API를 사용 하 여 `LocalFileSystem.TEMPORARY` 또는 ' ms appdata: 온도 / / / /<filename>' URI. - -* 기록 시간에 지정 된 하위 디렉터리에 이미 존재 해야 합니다. - -### 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 -* 윈도우 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`= 1 -* `MediaError.MEDIA_ERR_NETWORK`= 2 -* `MediaError.MEDIA_ERR_DECODE`= 3 -* `MediaError.MEDIA_ERR_NONE_SUPPORTED`= 4
\ No newline at end of file diff --git a/plugins/org.apache.cordova.media/doc/pl/index.md b/plugins/org.apache.cordova.media/doc/pl/index.md deleted file mode 100644 index 81fdb311..00000000 --- a/plugins/org.apache.cordova.media/doc/pl/index.md +++ /dev/null @@ -1,494 +0,0 @@ -<!--- - 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 - -Plugin daje możliwość nagrywania i odtwarzania plików audio na urządzeniu. - -**Uwaga**: Obecna implementacja nie stosować się do specyfikacji W3C do przechwytywania mediów i jest dostarczane jedynie dla wygody. Przyszłej realizacji będą przylegać do najnowszych specyfikacji W3C i może potępiać bieżące interfejsów API. - -## Instalacja - - cordova plugin add org.apache.cordova.media - - -## Obsługiwane platformy - -* Android -* BlackBerry 10 -* iOS -* Windows Phone 7 i 8 -* Tizen -* Windows 8 - -## Windows Phone dziwactwa - -* Tylko jeden plik mogą być zagrany w tył w czasie. - -* Istnieją ścisłe ograniczenia na jak aplikacja współdziała z innymi mediami. Zobacz [Microsoft dokumentacji szczegóły][1]. - - [1]: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh184838(v=vs.92).aspx - -## Media - - var media = new Media(src, mediaSuccess, [mediaError], [mediaStatus]); - - -### Parametry - -* **src**: URI zawierający zawartość audio. *(DOMString)* - -* **mediaSuccess**: (opcjonalne) wywołania zwrotnego, który wykonuje po `Media` obiektu została zakończona bieżącej gry, rekordu lub działania stop. *(Funkcja)* - -* **mediaError**: (opcjonalne) wywołania zwrotnego, która wykonuje w przypadku wystąpienia błędu. *(Funkcja)* - -* **mediaStatus**: (opcjonalne) wywołania zwrotnego, który wykonuje wskazać zmiany statusu. *(Funkcja)* - -### Stałe - -Poniższe stałe są zgłaszane jako parametr tylko do `mediaStatus` wywołania zwrotnego: - -* `Media.MEDIA_NONE`= 0; -* `Media.MEDIA_STARTING`= 1; -* `Media.MEDIA_RUNNING`= 2; -* `Media.MEDIA_PAUSED`= 3; -* `Media.MEDIA_STOPPED`= 4; - -### Metody - -* `media.getCurrentPosition`: Zwraca bieżącej pozycji w pliku audio. - -* `media.getDuration`: Zwraca czas trwania pliku audio. - -* `media.play`: Rozpoczęcie lub wznowienie odtwarzania pliku audio. - -* `media.pause`: Wstrzymanie odtwarzania pliku audio. - -* `media.release`: Zwalnia zasoby audio system operacyjny. - -* `media.seekTo`: Porusza się pozycji w pliku audio. - -* `media.setVolume`: Ustaw głośność odtwarzania dźwięku. - -* `media.startRecord`: Nagrywanie pliku audio. - -* `media.stopRecord`: Zatrzymaj nagrywanie pliku audio. - -* `media.stop`: Zatrzymania odtwarzania pliku audio. - -### Parametry dodatkowe ReadOnly - -* **stanowisko**: stanowisko w odtwarzaniu dźwięku, w kilka sekund. - - * Nie jest automatycznie aktualizowana podczas odtwarzania; wywołanie `getCurrentPosition` aktualizacji. - -* **czas**: trwania mediów, w kilka sekund. - -## media.getCurrentPosition - -Zwraca bieżącą pozycję w pliku audio. Również aktualizacje `Media` obiektu `position` parametr. - - media.getCurrentPosition(mediaSuccess, [mediaError]); - - -### Parametry - -* **mediaSuccess**: wywołania zwrotnego, który jest przekazywany bieżącej pozycji w kilka sekund. - -* **mediaError**: (opcjonalne) wywołanie zwrotne do wykonać, jeśli wystąpi błąd. - -### Szybki przykład - - // 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 - -Zwraca czas trwania pliku audio w kilka sekund. Jeśli czas trwania jest nieznane, to zwraca wartość -1. - - media.getDuration(); - - -### Szybki przykład - - // 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 - -Wstrzymuje odtwarzanie pliku audio. - - media.pause(); - - -### Szybki przykład - - // 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 - -Rozpoczyna się lub wznawia odtwarzanie pliku audio. - - media.play(); - - -### Szybki przykład - - // 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(); - } - - -### Dziwactwa iOS - -* **numberOfLoops**: przekazać tę opcję, aby `play` Metoda, aby określić ile razy chcesz, pliku multimedialnego do gry, np.: - - var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") - myMedia.play({ numberOfLoops: 2 }) - - -* **playAudioWhenScreenIsLocked**: przekazać tę opcję, aby `play` Metoda, aby określić, czy chcesz umożliwić odtwarzanie, gdy ekran jest zablokowana. Jeśli zestaw `true` (wartość domyślna), stan przycisku Wycisz sprzętu jest ignorowane, np.: - - var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") - myMedia.play({ playAudioWhenScreenIsLocked : false }) - - -* **kolejność wyszukiwania plików**: gdy tylko nazwa pliku lub ścieżka prosta pod warunkiem, iOS wyszukiwania w `www` katalogu, pliku, a następnie w aplikacji `documents/tmp` katalogu: - - 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 - -Zwalnia zasoby audio system operacyjny. Jest to szczególnie ważne dla systemu Android, ponieważ istnieje skończona ilość podstawie OpenCore wystąpień do odtwarzania multimediów. Aplikacje powinny wywoływać `release` funkcja dla każdego `Media` zasób, który nie jest już potrzebna. - - media.release(); - - -### Szybki przykład - - // Audio player - // - var my_media = new Media(src, onSuccess, onError); - - my_media.play(); - my_media.stop(); - my_media.release(); - - -## media.seekTo - -Ustawia bieżącej pozycji w pliku audio. - - media.seekTo(milliseconds); - - -### Parametry - -* **milisekund**: stanowisko ustala pozycję odtwarzania w audio, w milisekundach. - -### Szybki przykład - - // 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); - - -### Jeżyna 10 dziwactwa - -* Nie obsługiwane na urządzeniach BlackBerry OS w wersji 5. - -## media.setVolume - -Ustaw głośność pliku audio. - - media.setVolume(volume); - - -### Parametry - -* **wielkość**: wielkość ustawić odtwarzanie. Wartość musi być z zakresu od 0.0 do 1.0. - -### Obsługiwane platformy - -* Android -* iOS - -### Szybki przykład - - // 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 - -Rozpoczyna nagrywanie pliku audio. - - media.startRecord(); - - -### Obsługiwane platformy - -* Android -* iOS -* Windows Phone 7 i 8 -* Windows 8 - -### Szybki przykład - - // 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(); - } - - -### Dziwactwa Androida - -* Urządzenia z systemem Android nagrywanie dźwięku w formacie Adaptive Multi-Rate. Określony plik powinien kończyć się rozszerzeniem *AMR* . - -### Dziwactwa iOS - -* iOS tylko rekordy do plików typu *.wav* i zwraca błąd, jeśli nazwa pliku rozszerzenie jest nie prawidłowe. - -* Jeśli nie podano pełną ścieżkę, nagrywanie jest umieszczony w aplikacji `documents/tmp` katalogu. To mogą być dostępne za pośrednictwem `File` za pomocą interfejsu API `LocalFileSystem.TEMPORARY` . Każdy podkatalog określony w rekordowym czasie musi już istnieć. - -* Pliki mogą być zapisywane i grał z powrotem za pomocą dokumentów URI: - - var myMedia = new Media("documents://beer.mp3") - - -### Windows 8 dziwactwa - -* Jeśli nie podano pełną ścieżkę, nagrywanie jest umieszczony w katalogu AppData/temp. To mogą być dostępne za pośrednictwem `Plik` Za pomocą interfejsu API `LocalFileSystem.TEMPORARY` lub "ms-appdata: temp / / / /<filename>"URI. - -* Każdy podkatalog określony w rekordowym czasie musi już istnieć. - -### Dziwactwa Tizen - -* Nie obsługiwane na Tizen urządzenia. - -## media.stop - -Zatrzymuje odtwarzanie pliku audio. - - Media.stop(); - - -### Szybki przykład - - // 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 - -Zatrzymuje nagrywanie pliku audio. - - media.stopRecord(); - - -### Obsługiwane platformy - -* Android -* iOS -* Windows Phone 7 i 8 -* Windows 8 - -### Szybki przykład - - // 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); - } - - -### Dziwactwa Tizen - -* Nie obsługiwane na Tizen urządzenia. - -## MediaError - -A `MediaError` obiekt jest zwracany do `mediaError` funkcji wywołania zwrotnego, gdy wystąpi błąd. - -### Właściwości - -* **Kod**: jeden z kodów błędów wstępnie zdefiniowanych poniżej. - -* **wiadomość**: komunikat o błędzie, opisując szczegóły błędu. - -### Stałe - -* `MediaError.MEDIA_ERR_ABORTED`= 1 -* `MediaError.MEDIA_ERR_NETWORK`= 2 -* `MediaError.MEDIA_ERR_DECODE`= 3 -* `MediaError.MEDIA_ERR_NONE_SUPPORTED`= 4
\ No newline at end of file diff --git a/plugins/org.apache.cordova.media/doc/ru/index.md b/plugins/org.apache.cordova.media/doc/ru/index.md deleted file mode 100644 index facda0f8..00000000 --- a/plugins/org.apache.cordova.media/doc/ru/index.md +++ /dev/null @@ -1,494 +0,0 @@ -<!--- - 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 - -Этот плагин предоставляет возможность записывать и воспроизводить аудио файлы на устройство. - -**Примечание**: Текущая реализация не соответствует спецификации W3C для захвата СМИ и предоставляется только для удобства. Будущее осуществление будет придерживаться последней спецификации W3C и может Опознайте текущих API. - -## Установка - - cordova plugin add org.apache.cordova.media - - -## Поддерживаемые платформы - -* Android -* BlackBerry 10 -* iOS -* Windows Phone 7 и 8 -* Tizen -* Windows 8 - -## Windows Phone причуды - -* Только один файл может воспроизводиться одновременно. - -* Существуют строгие ограничения в отношении как ваше приложение взаимодействует с другими средствами массовой информации. Смотрите в [документации 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, содержащий аудио-контент. *(DOMString)* - -* **mediaSuccess**: (необязательно) обратного вызова, который выполняется после `Media` объект завершения текущего воспроизведения, записи или стоп действий. *(Функция)* - -* **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`: Остановка воспроизведения звукового файла. - -### Дополнительные ReadOnly параметры - -* **позиции**: позиция в аудио воспроизведения в секундах. - - * Не автоматически обновляются во время игры; Вызовите `getCurrentPosition` для обновления. - -* **Продолжительность**: продолжительность СМИ, в секундах. - -## media.getCurrentPosition - -Возвращает текущую позицию в звуковой файл. Также обновляет `Media` объекта `position` параметр. - - 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 - -Возвращает продолжительность аудио файла в секундах. Если длительность неизвестна, она возвращает значение -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 - -Освобождает ресурсы аудио базовой операционной системы. Это особенно важно для Android, так как существует конечное количество экземпляров OpenCore для воспроизведения мультимедиа. Приложения должны вызвать `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); - - -### Особенности BlackBerry 10 - -* Не поддерживается на устройствах BlackBerry OS 5. - -## media.setVolume - -Задайте громкость звукового файла. - - media.setVolume(volume); - - -### Параметры - -* **объем**: тома, чтобы задать для воспроизведения. Значение должно быть в диапазоне от 0.0 до 1.0. - -### Поддерживаемые платформы - -* Android -* 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(); - - -### Поддерживаемые платформы - -* Android -* 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") - - -### Совместимости Windows 8 - -* Если не указан полный путь, запись помещается в каталоге AppData/temp. Это могут быть доступны через `Файл` С помощью API `LocalFileSystem.TEMPORARY` или ' ms-appdata: / / / temp /<filename>' URI. - -* Любой подкаталог указанного в рекордное время должна уже существовать. - -### Особенности 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(); - - -### Поддерживаемые платформы - -* Android -* 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` функции обратного вызова при возникновении ошибки. - -### Параметры - -* **code**: один из стандартных кодов ошибок, перечисленных ниже. - -* **сообщение**: сообщение об ошибке, с подробными сведениями об ошибке. - -### Константы - -* `MediaError.MEDIA_ERR_ABORTED`= 1 -* `MediaError.MEDIA_ERR_NETWORK`= 2 -* `MediaError.MEDIA_ERR_DECODE`= 3 -* `MediaError.MEDIA_ERR_NONE_SUPPORTED`= 4
\ No newline at end of file diff --git a/plugins/org.apache.cordova.media/doc/zh/index.md b/plugins/org.apache.cordova.media/doc/zh/index.md deleted file mode 100644 index c94104a8..00000000 --- a/plugins/org.apache.cordova.media/doc/zh/index.md +++ /dev/null @@ -1,494 +0,0 @@ -<!--- - 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 - -這個外掛程式提供錄製和播放設備上的音訊檔的能力。 - -**注**: 當前的實現並不遵循 W3C 規範的媒體捕獲和僅用於提供方便。 將來的實現將堅持以最新的 W3C 規範和可能棄用當前 Api。 - -## 安裝 - - cordova plugin add org.apache.cordova.media - - -## 支援的平臺 - -* Android 系統 -* 黑莓 10 -* iOS -* Windows Phone 7 和 8 -* Tizen -* Windows 8 - -## Windows Phone 怪癖 - -* 只有一個媒體檔案,可以播放一次。 - -* 沒有嚴格限制對您的應用程式與其他媒體的對話模式。 請參見[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。*() DOMString* - -* **mediaSuccess**: (可選) 後執行的回檔 `Media` 物件已完成當前戲劇、 記錄或停止行動。*(函數)* - -* **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 - -返回一個音訊檔內的當前位置。此外可以更新 `Media` 物件的 `position` 參數。 - - 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 - -以秒為單位返回一個音訊檔的持續時間。如果持續時間是未知的則傳回值為-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 - -釋放底層作業系統的音訊資源。 這是特別重要的 android 作業系統,因為有了有限數量的 OpenCore 實例播放媒體。 應用程式應當調用 `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 的範圍內。 - -### 支援的平臺 - -* Android 系統 -* 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() ; - - -### 支援的平臺 - -* Android 系統 -* 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") - - -### Windows 8 的怪癖 - -* 如果沒有提供完整的路徑,錄音被放在應用程式/temp 目錄。這可以通過訪問 `檔` API 使用 `LocalFileSystem.TEMPORARY` 或 ' ms appdata: temp / / /<filename>' URI。 - -* 在記錄時指定的任何子目錄中必須已經存在。 - -### 泰怪癖 - -* 不支援在 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 設備上。 - -## MediaError - -A `MediaError` 物件返回到 `mediaError` 時出現錯誤的回呼函數。 - -### 屬性 - -* **代碼**: 下面列出的預定義的錯誤代碼之一。 - -* **消息**: 錯誤訊息,描述該錯誤的詳細資訊。 - -### 常量 - -* `MediaError.MEDIA_ERR_ABORTED`= 1 -* `MediaError.MEDIA_ERR_NETWORK`= 2 -* `MediaError.MEDIA_ERR_DECODE`= 3 -* `MediaError.MEDIA_ERR_NONE_SUPPORTED`= 4
\ No newline at end of file |
