mirror of
https://github.com/apache/cordova-android.git
synced 2025-05-13 14:51:40 +08:00
added create message handler, updated AudioPlayer constructor usage
This commit is contained in:
parent
aa45670d87
commit
3c9415b1c2
@ -96,6 +96,12 @@ public class AudioHandler extends Plugin {
|
|||||||
float f = this.getDurationAudio(args.getString(0), args.getString(1));
|
float f = this.getDurationAudio(args.getString(0), args.getString(1));
|
||||||
return new PluginResult(status, f);
|
return new PluginResult(status, f);
|
||||||
}
|
}
|
||||||
|
else if (action.equals("create")) {
|
||||||
|
String id = args.getString(0);
|
||||||
|
String src = args.getString(1);
|
||||||
|
AudioPlayer audio = new AudioPlayer(this, id, src);
|
||||||
|
this.players.put(id, audio);
|
||||||
|
}
|
||||||
else if (action.equals("release")) {
|
else if (action.equals("release")) {
|
||||||
boolean b = this.release(args.getString(0));
|
boolean b = this.release(args.getString(0));
|
||||||
return new PluginResult(status, b);
|
return new PluginResult(status, b);
|
||||||
@ -196,7 +202,7 @@ public class AudioHandler extends Plugin {
|
|||||||
if (this.players.containsKey(id)) {
|
if (this.players.containsKey(id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AudioPlayer audio = new AudioPlayer(this, id);
|
AudioPlayer audio = new AudioPlayer(this, id, file);
|
||||||
this.players.put(id, audio);
|
this.players.put(id, audio);
|
||||||
audio.startRecording(file);
|
audio.startRecording(file);
|
||||||
}
|
}
|
||||||
@ -221,7 +227,7 @@ public class AudioHandler extends Plugin {
|
|||||||
public void startPlayingAudio(String id, String file) {
|
public void startPlayingAudio(String id, String file) {
|
||||||
AudioPlayer audio = this.players.get(id);
|
AudioPlayer audio = this.players.get(id);
|
||||||
if (audio == null) {
|
if (audio == null) {
|
||||||
audio = new AudioPlayer(this, id);
|
audio = new AudioPlayer(this, id, file);
|
||||||
this.players.put(id, audio);
|
this.players.put(id, audio);
|
||||||
}
|
}
|
||||||
audio.startPlaying(file);
|
audio.startPlaying(file);
|
||||||
@ -292,7 +298,7 @@ public class AudioHandler extends Plugin {
|
|||||||
|
|
||||||
// If not already open, then open the file
|
// If not already open, then open the file
|
||||||
else {
|
else {
|
||||||
audio = new AudioPlayer(this, id);
|
audio = new AudioPlayer(this, id, file);
|
||||||
this.players.put(id, audio);
|
this.players.put(id, audio);
|
||||||
return (audio.getDuration(file));
|
return (audio.getDuration(file));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user