@capgo/native-audio
Advanced tools
@@ -859,3 +859,3 @@ package ee.forgr.audio; | ||
| if (assetPath.endsWith(".m3u8")) { | ||
| if (isHlsUrl(assetPath)) { | ||
| // HLS Stream - check if HLS support is available | ||
@@ -1069,2 +1069,28 @@ if (!HlsAvailabilityChecker.isHlsAvailable()) { | ||
| /** | ||
| * Check if the given URL is an HLS stream by examining the URL path. | ||
| * This handles URLs with query parameters correctly. | ||
| * | ||
| * @param assetPath The URL or path to check | ||
| * @return true if the URL path ends with .m3u8, false otherwise | ||
| */ | ||
| private boolean isHlsUrl(String assetPath) { | ||
| if (assetPath == null || assetPath.isEmpty()) { | ||
| return false; | ||
| } | ||
| try { | ||
| Uri uri = Uri.parse(assetPath); | ||
| String path = uri.getPath(); | ||
| if (path != null) { | ||
| return path.toLowerCase().endsWith(".m3u8"); | ||
| } | ||
| } catch (Exception e) { | ||
| Log.w(TAG, "Failed to parse URL for HLS detection: " + assetPath, e); | ||
| } | ||
| // Fallback: check if the URL contains .m3u8 followed by nothing or query params | ||
| return assetPath.toLowerCase().contains(".m3u8"); | ||
| } | ||
| /** | ||
| * Creates a StreamAudioAsset via reflection. | ||
@@ -1071,0 +1097,0 @@ * This allows the StreamAudioAsset class to be excluded at compile time when HLS is disabled, |
@@ -16,3 +16,3 @@ import AVFoundation | ||
| public class NativeAudio: CAPPlugin, AVAudioPlayerDelegate, CAPBridgedPlugin { | ||
| private let pluginVersion: String = "8.2.8" | ||
| private let pluginVersion: String = "8.2.9" | ||
| public let identifier = "NativeAudio" | ||
@@ -19,0 +19,0 @@ public let jsName = "NativeAudio" |
+1
-1
| { | ||
| "name": "@capgo/native-audio", | ||
| "version": "8.2.8", | ||
| "version": "8.2.9", | ||
| "description": "A native plugin for native audio engine", | ||
@@ -5,0 +5,0 @@ "license": "MPL-2.0", |
460439
0.19%5421
0.43%