mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-31 23:20:35 +02:00
Fix local audio playback issue, update ffmpeg-kit to min version
This commit is contained in:
parent
441bc24e2d
commit
9d6a467517
4 changed files with 17 additions and 10 deletions
|
@ -29,7 +29,7 @@ android {
|
||||||
applicationId "com.audiobookshelf.app"
|
applicationId "com.audiobookshelf.app"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 69
|
versionCode 70
|
||||||
versionName "0.9.41-beta"
|
versionName "0.9.41-beta"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
aaptOptions {
|
aaptOptions {
|
||||||
|
@ -120,7 +120,7 @@ dependencies {
|
||||||
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1'
|
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1'
|
||||||
|
|
||||||
// FFMPEG-Kit
|
// 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'
|
apply from: 'capacitor.build.gradle'
|
||||||
|
|
|
@ -104,7 +104,9 @@ class FolderScanner(var ctx: Context) {
|
||||||
var coverContentUrl:String? = null
|
var coverContentUrl:String? = null
|
||||||
var coverAbsolutePath: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 ->
|
var existingLocalFilesRemoved = existingLocalFiles.filter { elf ->
|
||||||
filesInFolder.find { fif -> DeviceManager.getBase64Id(fif.id) == elf.id } == null // File was not found in media item folder
|
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 ->
|
filesInFolder.forEach { file ->
|
||||||
var mimeType = file.mimeType ?: ""
|
var mimeType = file.mimeType ?: ""
|
||||||
var filename = file.name ?: ""
|
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")
|
Log.d(tag, "Found $mimeType file $filename in folder $itemFolderName")
|
||||||
|
|
||||||
var localFileId = DeviceManager.getBase64Id(file.id)
|
var localFileId = DeviceManager.getBase64Id(file.id)
|
||||||
|
|
|
@ -309,16 +309,19 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
||||||
if (mPlayer == currentPlayer) {
|
if (mPlayer == currentPlayer) {
|
||||||
var mediaSource:MediaSource
|
var mediaSource:MediaSource
|
||||||
|
|
||||||
var dataSourceFactory = DefaultHttpDataSource.Factory()
|
|
||||||
dataSourceFactory.setUserAgent(channelId)
|
|
||||||
if (playbackSession.isLocal) {
|
if (playbackSession.isLocal) {
|
||||||
Log.d(tag, "Playing Local Item")
|
Log.d(tag, "Playing Local Item")
|
||||||
|
var dataSourceFactory = DefaultDataSource.Factory(ctx)
|
||||||
mediaSource = ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItems[0])
|
mediaSource = ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItems[0])
|
||||||
} else if (!playbackSession.isHLS) {
|
} else if (!playbackSession.isHLS) {
|
||||||
Log.d(tag, "Direct Playing Item")
|
Log.d(tag, "Direct Playing Item")
|
||||||
|
var dataSourceFactory = DefaultHttpDataSource.Factory()
|
||||||
|
dataSourceFactory.setUserAgent(channelId)
|
||||||
mediaSource = ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItems[0])
|
mediaSource = ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItems[0])
|
||||||
} else {
|
} else {
|
||||||
Log.d(tag, "Playing HLS Item")
|
Log.d(tag, "Playing HLS Item")
|
||||||
|
var dataSourceFactory = DefaultHttpDataSource.Factory()
|
||||||
|
dataSourceFactory.setUserAgent(channelId)
|
||||||
dataSourceFactory.setDefaultRequestProperties(hashMapOf("Authorization" to "Bearer ${DeviceManager.token}"))
|
dataSourceFactory.setDefaultRequestProperties(hashMapOf("Authorization" to "Bearer ${DeviceManager.token}"))
|
||||||
mediaSource = HlsMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItems[0])
|
mediaSource = HlsMediaSource.Factory(dataSourceFactory).createMediaSource(mediaItems[0])
|
||||||
}
|
}
|
||||||
|
|
|
@ -545,13 +545,15 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
closePlayback() {
|
closePlayback() {
|
||||||
|
this.endPlayback()
|
||||||
|
AbsAudioPlayer.closePlayback()
|
||||||
|
},
|
||||||
|
endPlayback() {
|
||||||
this.$store.commit('setPlayerItem', null)
|
this.$store.commit('setPlayerItem', null)
|
||||||
this.showFullscreen = false
|
this.showFullscreen = false
|
||||||
this.isEnded = false
|
this.isEnded = false
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
this.playbackSession = null
|
this.playbackSession = null
|
||||||
|
|
||||||
AbsAudioPlayer.closePlayback()
|
|
||||||
},
|
},
|
||||||
//
|
//
|
||||||
// Listeners from audio AbsAudioPlayer
|
// Listeners from audio AbsAudioPlayer
|
||||||
|
@ -607,13 +609,13 @@ export default {
|
||||||
},
|
},
|
||||||
onPlaybackClosed() {
|
onPlaybackClosed() {
|
||||||
console.log('Received onPlaybackClosed evt')
|
console.log('Received onPlaybackClosed evt')
|
||||||
this.closePlayback()
|
this.endPlayback()
|
||||||
},
|
},
|
||||||
onPlaybackFailed(data) {
|
onPlaybackFailed(data) {
|
||||||
console.log('Received onPlaybackFailed evt')
|
console.log('Received onPlaybackFailed evt')
|
||||||
var errorMessage = data.value || 'Unknown Error'
|
var errorMessage = data.value || 'Unknown Error'
|
||||||
this.$toast.error(`Playback Failed: ${errorMessage}`)
|
this.$toast.error(`Playback Failed: ${errorMessage}`)
|
||||||
this.closePlayback()
|
this.endPlayback()
|
||||||
},
|
},
|
||||||
async init() {
|
async init() {
|
||||||
this.useChapterTrack = await this.$localStore.getUseChapterTrack()
|
this.useChapterTrack = await this.$localStore.getUseChapterTrack()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue