@capgo/native-audio 8.2.8 → 8.2.10

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.
@@ -69,7 +69,7 @@ dependencies {
69
69
  testImplementation "junit:junit:$junitVersion"
70
70
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
71
71
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
72
- implementation 'androidx.media3:media3-exoplayer:1.9.0'
72
+ implementation 'androidx.media3:media3-exoplayer:1.9.2'
73
73
 
74
74
  // HLS (m3u8) streaming support - optional dependency
75
75
  // When disabled, reduces APK size by ~4MB
@@ -856,7 +856,7 @@ public class NativeAudio extends Plugin implements AudioManager.OnAudioFocusChan
856
856
  }
857
857
  }
858
858
 
859
- if (assetPath.endsWith(".m3u8")) {
859
+ if (isHlsUrl(assetPath)) {
860
860
  // HLS Stream - check if HLS support is available
861
861
  if (!HlsAvailabilityChecker.isHlsAvailable()) {
862
862
  throw new Exception(
@@ -1064,6 +1064,32 @@ public class NativeAudio extends Plugin implements AudioManager.OnAudioFocusChan
1064
1064
  return (value != null && !value.isEmpty() && !value.equals("null"));
1065
1065
  }
1066
1066
 
1067
+ /**
1068
+ * Check if the given URL is an HLS stream by examining the URL path.
1069
+ * This handles URLs with query parameters correctly.
1070
+ *
1071
+ * @param assetPath The URL or path to check
1072
+ * @return true if the URL path ends with .m3u8, false otherwise
1073
+ */
1074
+ private boolean isHlsUrl(String assetPath) {
1075
+ if (assetPath == null || assetPath.isEmpty()) {
1076
+ return false;
1077
+ }
1078
+
1079
+ try {
1080
+ Uri uri = Uri.parse(assetPath);
1081
+ String path = uri.getPath();
1082
+ if (path != null) {
1083
+ return path.toLowerCase().endsWith(".m3u8");
1084
+ }
1085
+ } catch (Exception e) {
1086
+ Log.w(TAG, "Failed to parse URL for HLS detection: " + assetPath, e);
1087
+ }
1088
+
1089
+ // Fallback: check if the URL contains .m3u8 followed by nothing or query params
1090
+ return assetPath.toLowerCase().contains(".m3u8");
1091
+ }
1092
+
1067
1093
  /**
1068
1094
  * Creates a StreamAudioAsset via reflection.
1069
1095
  * This allows the StreamAudioAsset class to be excluded at compile time when HLS is disabled,
@@ -13,7 +13,7 @@ enum MyError: Error {
13
13
  // swiftlint:disable type_body_length file_length
14
14
  @objc(NativeAudio)
15
15
  public class NativeAudio: CAPPlugin, AVAudioPlayerDelegate, CAPBridgedPlugin {
16
- private let pluginVersion: String = "8.2.8"
16
+ private let pluginVersion: String = "8.2.10"
17
17
  public let identifier = "NativeAudio"
18
18
  public let jsName = "NativeAudio"
19
19
  public let pluginMethods: [CAPPluginMethod] = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/native-audio",
3
- "version": "8.2.8",
3
+ "version": "8.2.10",
4
4
  "description": "A native plugin for native audio engine",
5
5
  "license": "MPL-2.0",
6
6
  "main": "dist/plugin.cjs.js",