5.4.2 commit

This commit is contained in:
Xilin Jia 2024-06-02 20:44:19 +01:00
parent 797e9b64ab
commit dc144a5b4a
9 changed files with 58 additions and 30 deletions

View File

@ -1,5 +1,5 @@
[Dolphin]
Timestamp=2024,2,5,7,26,48.63
Timestamp=2024,6,2,20,10,4.557
Version=4
ViewMode=1

View File

@ -159,8 +159,8 @@ android {
// Version code schema (not used):
// "1.2.3-beta4" -> 1020304
// "1.2.3" -> 1020395
versionCode 3020148
versionName "5.4.1"
versionCode 3020149
versionName "5.4.2"
def commit = ""
try {

View File

@ -100,8 +100,16 @@ abstract class PlaybackController(private val activity: FragmentActivity) {
activity.registerReceiver(notificationReceiver, IntentFilter(PlaybackServiceConstants.ACTION_PLAYER_NOTIFICATION))
}
if (!released) bindToService()
else throw IllegalStateException("Can't call init() after release() has been called")
// TODO: java.lang.IllegalStateException: Can't call init() after release() has been called
// at ac.mdiq.podcini.playback.PlaybackController.initServiceRunning(SourceFile:104)
if (!released) {
bindToService()
} else {
released = false
bindToService()
Logd(TAG, "Testing bindToService if released")
// throw IllegalStateException("Can't call init() after release() has been called")
}
checkMediaInfoLoaded()
}

View File

@ -84,6 +84,7 @@ class LocalMediaPlayer(context: Context, callback: MediaPlayerCallback) : MediaP
private val bufferUpdateInterval = 5000L
// private val bufferingUpdateDisposable: Disposable
private var mediaSource: MediaSource? = null
private var mediaItem: MediaItem? = null
private var playbackParameters: PlaybackParameters
private var bufferedPercentagePrev = 0
@ -119,8 +120,10 @@ class LocalMediaPlayer(context: Context, callback: MediaPlayerCallback) : MediaP
@Throws(IllegalStateException::class)
private fun prepareWR() {
if (mediaSource == null) return
exoPlayer?.setMediaSource(mediaSource!!, false)
if (mediaSource == null && mediaItem == null) return
if (mediaSource != null) exoPlayer?.setMediaSource(mediaSource!!, false)
else exoPlayer?.setMediaItem(mediaItem!!)
exoPlayer?.prepare()
}
@ -159,26 +162,29 @@ class LocalMediaPlayer(context: Context, callback: MediaPlayerCallback) : MediaP
@Throws(IllegalArgumentException::class, IllegalStateException::class)
private fun setDataSource(m: MediaMetadata, s: String, user: String?, password: String?) {
Logd(TAG, "setDataSource: $s")
if (httpDataSourceFactory == null)
httpDataSourceFactory = OkHttpDataSource.Factory(PodciniHttpClient.getHttpClient() as okhttp3.Call.Factory).setUserAgent(ClientConfig.USER_AGENT)
if (!user.isNullOrEmpty() && !password.isNullOrEmpty()) {
val requestProperties = HashMap<String, String>()
requestProperties["Authorization"] = HttpCredentialEncoder.encode(user, password, "ISO-8859-1")
httpDataSourceFactory!!.setDefaultRequestProperties(requestProperties)
}
val dataSourceFactory: DataSource.Factory = DefaultDataSourceFactory(context, null, httpDataSourceFactory!!)
val extractorsFactory = DefaultExtractorsFactory()
extractorsFactory.setConstantBitrateSeekingEnabled(true)
extractorsFactory.setMp3ExtractorFlags(Mp3Extractor.FLAG_DISABLE_ID3_METADATA)
val f = ProgressiveMediaSource.Factory(dataSourceFactory, extractorsFactory)
val mediaItem = MediaItem.Builder()
mediaItem = MediaItem.Builder()
.setUri(Uri.parse(s))
.setMediaMetadata(m).build()
mediaSource = null
mediaSource = f.createMediaSource(mediaItem)
if (!user.isNullOrEmpty() && !password.isNullOrEmpty()) {
if (httpDataSourceFactory == null)
httpDataSourceFactory = OkHttpDataSource.Factory(PodciniHttpClient.getHttpClient() as okhttp3.Call.Factory).setUserAgent(ClientConfig.USER_AGENT)
if (!user.isNullOrEmpty() && !password.isNullOrEmpty()) {
val requestProperties = HashMap<String, String>()
requestProperties["Authorization"] = HttpCredentialEncoder.encode(user, password, "ISO-8859-1")
httpDataSourceFactory!!.setDefaultRequestProperties(requestProperties)
}
val dataSourceFactory: DataSource.Factory = DefaultDataSourceFactory(context, null, httpDataSourceFactory!!)
val extractorsFactory = DefaultExtractorsFactory()
extractorsFactory.setConstantBitrateSeekingEnabled(true)
extractorsFactory.setMp3ExtractorFlags(Mp3Extractor.FLAG_DISABLE_ID3_METADATA)
val f = ProgressiveMediaSource.Factory(dataSourceFactory, extractorsFactory)
mediaSource = f.createMediaSource(mediaItem!!)
}
}
private fun play() {
@ -821,7 +827,7 @@ class LocalMediaPlayer(context: Context, callback: MediaPlayerCallback) : MediaP
var cause = error.cause
if (cause is HttpDataSourceException && cause.cause != null) cause = cause.cause
if (cause != null && "Source error" == cause.message) cause = cause.cause
audioErrorListener?.accept(if (cause != null) cause.message else error.message)
audioErrorListener?.accept((if (cause != null) cause.message else error.message) ?:"no message")
}
}

View File

@ -1,6 +1,5 @@
package ac.mdiq.podcini.storage
import ac.mdiq.podcini.util.Logd
import android.content.Context
import android.net.Uri
import android.util.Log

View File

@ -119,7 +119,7 @@ class EpisodeHomeFragment : Fragment() {
if (!ttsReady) initializeTTS(requireContext())
withContext(Dispatchers.Main) {
binding.readerView.loadDataWithBaseURL("https://127.0.0.1", cleanedNotes!!, "text/html", "UTF-8", null)
binding.readerView.loadDataWithBaseURL("https://127.0.0.1", cleanedNotes?:"No notes", "text/html", "UTF-8", null)
binding.readerView.visibility = View.VISIBLE
binding.webView.visibility = View.GONE
}

View File

@ -210,7 +210,7 @@ class PlayerDetailsFragment : Fragment() {
withContext(Dispatchers.Main) {
Logd(TAG, "subscribe: ${media?.getEpisodeTitle()}")
displayMediaInfo(media!!)
shownoteView.loadDataWithBaseURL("https://127.0.0.1", cleanedNotes!!, "text/html", "utf-8", "about:blank")
shownoteView.loadDataWithBaseURL("https://127.0.0.1", cleanedNotes?:"No notes", "text/html", "utf-8", "about:blank")
Logd(TAG, "Webview loaded")
}
}.invokeOnCompletion { throwable ->
@ -241,12 +241,12 @@ class PlayerDetailsFragment : Fragment() {
if (!homeText.isNullOrEmpty()) {
val shownotesCleaner = ShownotesCleaner(requireContext(), homeText!!, 0)
cleanedNotes = shownotesCleaner.processShownotes()
shownoteView.loadDataWithBaseURL("https://127.0.0.1", cleanedNotes!!, "text/html", "UTF-8", null)
shownoteView.loadDataWithBaseURL("https://127.0.0.1", cleanedNotes?:"No notes", "text/html", "UTF-8", null)
} else Toast.makeText(context, R.string.web_content_not_available, Toast.LENGTH_LONG).show()
} else {
val shownotesCleaner = ShownotesCleaner(requireContext(), item?.description ?: "", media?.getDuration()?:0)
cleanedNotes = shownotesCleaner.processShownotes()
if (!cleanedNotes.isNullOrEmpty()) shownoteView.loadDataWithBaseURL("https://127.0.0.1", cleanedNotes!!, "text/html", "UTF-8", null)
if (!cleanedNotes.isNullOrEmpty()) shownoteView.loadDataWithBaseURL("https://127.0.0.1", cleanedNotes?:"No notes", "text/html", "UTF-8", null)
else Toast.makeText(context, R.string.web_content_not_available, Toast.LENGTH_LONG).show()
}
}

View File

@ -1,3 +1,10 @@
## 5.4.2
* likely fixed crash issue when the app is restarted after long idle
* fixed null pointer crash issue in when trying to report player error
* fixed null pointer crash issue when open player detailed view with online episode
* likely fixed the audio break issue when streaming some podcasts, particularly those related to "iHeart" (actually the server has some invalid settings, someone should notify them).
this should take effect with episodes in both subscribed or online feeds
## 5.4.1

View File

@ -0,0 +1,8 @@
Version 5.4.2 brings several changes:
* likely fixed crash issue when the app is restarted after long idle
* fixed null pointer crash issue in when trying to report player error
* fixed null pointer crash issue when open player detailed view with online episode
* likely fixed the audio break issue when streaming some podcasts, particularly those related to "iHeart" (actually the server has some invalid settings, someone should notify them).
this should take effect with episodes in both subscribed or online feeds