diff --git a/android/app/build.gradle b/android/app/build.gradle index 1a9581e6..366ad747 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -29,7 +29,7 @@ android { applicationId "com.audiobookshelf.app" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 69 + versionCode 70 versionName "0.9.41-beta" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { @@ -120,7 +120,7 @@ dependencies { implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1' // FFMPEG-Kit - implementation 'com.arthenica:ffmpeg-kit-full:4.5.1' + implementation 'com.arthenica:ffmpeg-kit-min:4.5.1' } apply from: 'capacitor.build.gradle' diff --git a/android/app/src/main/java/com/audiobookshelf/app/device/FolderScanner.kt b/android/app/src/main/java/com/audiobookshelf/app/device/FolderScanner.kt index 9d8210a5..0737a536 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/device/FolderScanner.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/device/FolderScanner.kt @@ -104,7 +104,9 @@ class FolderScanner(var ctx: Context) { var coverContentUrl:String? = null var coverAbsolutePath:String? = null - var filesInFolder = itemFolder.search(false, DocumentFileType.FILE, arrayOf("audio/*", "image/*")) +// itemFolder.search(false, DocumentFileType.FILE, arrayOf("audio")) + + var filesInFolder = itemFolder.search(false, DocumentFileType.FILE, arrayOf("audio/*", "image/*", "video/mp4")) var existingLocalFilesRemoved = existingLocalFiles.filter { elf -> filesInFolder.find { fif -> DeviceManager.getBase64Id(fif.id) == elf.id } == null // File was not found in media item folder @@ -117,7 +119,7 @@ class FolderScanner(var ctx: Context) { filesInFolder.forEach { file -> var mimeType = file.mimeType ?: "" var filename = file.name ?: "" - var isAudio = mimeType.startsWith("audio") + var isAudio = mimeType.startsWith("audio") || mimeType == "video/mp4" Log.d(tag, "Found $mimeType file $filename in folder $itemFolderName") var localFileId = DeviceManager.getBase64Id(file.id) diff --git a/android/app/src/main/java/com/audiobookshelf/app/player/PlayerNotificationService.kt b/android/app/src/main/java/com/audiobookshelf/app/player/PlayerNotificationService.kt index 37695f4c..6b7dff07 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/player/PlayerNotificationService.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/player/PlayerNotificationService.kt @@ -309,16 +309,19 @@ class PlayerNotificationService : MediaBrowserServiceCompat() { if (mPlayer == currentPlayer) { var mediaSource:MediaSource - var dataSourceFactory = DefaultHttpDataSource.Factory() - dataSourceFactory.setUserAgent(channelId) if (playbackSession.isLocal) { Log.d(tag, "Playing Local Item") + var dataSourceFactory = DefaultDataSource.Factory(ctx) mediaSource = ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItems[0]) } else if (!playbackSession.isHLS) { Log.d(tag, "Direct Playing Item") + var dataSourceFactory = DefaultHttpDataSource.Factory() + dataSourceFactory.setUserAgent(channelId) mediaSource = ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItems[0]) } else { Log.d(tag, "Playing HLS Item") + var dataSourceFactory = DefaultHttpDataSource.Factory() + dataSourceFactory.setUserAgent(channelId) dataSourceFactory.setDefaultRequestProperties(hashMapOf("Authorization" to "Bearer ${DeviceManager.token}")) mediaSource = HlsMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItems[0]) } diff --git a/components/app/AudioPlayer.vue b/components/app/AudioPlayer.vue index 4e7bfe52..c9a63344 100644 --- a/components/app/AudioPlayer.vue +++ b/components/app/AudioPlayer.vue @@ -545,13 +545,15 @@ export default { } }, closePlayback() { + this.endPlayback() + AbsAudioPlayer.closePlayback() + }, + endPlayback() { this.$store.commit('setPlayerItem', null) this.showFullscreen = false this.isEnded = false this.isLoading = false this.playbackSession = null - - AbsAudioPlayer.closePlayback() }, // // Listeners from audio AbsAudioPlayer @@ -607,13 +609,13 @@ export default { }, onPlaybackClosed() { console.log('Received onPlaybackClosed evt') - this.closePlayback() + this.endPlayback() }, onPlaybackFailed(data) { console.log('Received onPlaybackFailed evt') var errorMessage = data.value || 'Unknown Error' this.$toast.error(`Playback Failed: ${errorMessage}`) - this.closePlayback() + this.endPlayback() }, async init() { this.useChapterTrack = await this.$localStore.getUseChapterTrack()