@mcfarljw/capacitor-audio 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,8 +44,8 @@ public class CapacitorAudio {
44
44
 
45
45
  public void play(String path, int track) {
46
46
  final Context context = this.context;
47
- final String trimmedPath = path.trim().replaceAll("^/+", "");
48
- final String absolutePath = context.getFilesDir().getAbsolutePath() + "/files/" + trimmedPath;
47
+ final String trimmedPath = path.trim().replaceFirst("^/", "");
48
+ final String absolutePath = context.getFilesDir().getAbsolutePath() + "/" + trimmedPath;
49
49
  final String parsedPath = Uri.parse(absolutePath).getPath();
50
50
 
51
51
  this.bridge.getActivity().runOnUiThread(() -> {
@@ -28,9 +28,9 @@ import Foundation
28
28
 
29
29
  @objc public func play(_ path: String, _ track: Int) -> Void {
30
30
  let trimmedPath = path.trimmingCharacters(in: .whitespaces).trimmingCharacters(in: CharacterSet(charactersIn: "/"))
31
- let documentPath = "\(self.documentDirectory!)\(trimmedPath)"
32
- let wwwPath = "\(self.wwwDirectory!)\(trimmedPath)"
33
- let publicPath = "\(self.publicDirectory!)\(trimmedPath)"
31
+ let documentPath = self.documentDirectory! + "/" + trimmedPath
32
+ let wwwPath = self.wwwDirectory! + "/" + trimmedPath
33
+ let publicPath = self.publicDirectory + "/" + trimmedPath
34
34
 
35
35
  DispatchQueue.global(qos: .userInitiated).async {
36
36
  var audioUrl: URL?
@@ -15,7 +15,7 @@ public class CapacitorAudioPlugin: CAPPlugin {
15
15
 
16
16
  @objc func play(_ call: CAPPluginCall) {
17
17
  let path = call.getString("path") ?? ""
18
- let track = call.getInt("path", 0)
18
+ let track = call.getInt("track", 0)
19
19
 
20
20
  implementation.play(path, track)
21
21
 
@@ -23,7 +23,7 @@ public class CapacitorAudioPlugin: CAPPlugin {
23
23
  }
24
24
 
25
25
  @objc func stop(_ call: CAPPluginCall) {
26
- let track = call.getInt("path", 0)
26
+ let track = call.getInt("track", 0)
27
27
 
28
28
  implementation.stop(track)
29
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcfarljw/capacitor-audio",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A native audio plugin for Ionic Capacitor.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",