Skip to content

Commit

Permalink
5.4.2 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Jun 2, 2024
1 parent 797e9b6 commit dc144a5
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .directory
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/java/ac/mdiq/podcini/playback/PlaybackController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}

Expand Down Expand Up @@ -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)

mediaItem = MediaItem.Builder()
.setUri(Uri.parse(s))
.setMediaMetadata(m).build()
mediaSource = null

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)
if (httpDataSourceFactory == null)
httpDataSourceFactory = OkHttpDataSource.Factory(PodciniHttpClient.getHttpClient() as okhttp3.Call.Factory).setUserAgent(ClientConfig.USER_AGENT)

val mediaItem = MediaItem.Builder()
.setUri(Uri.parse(s))
.setMediaMetadata(m).build()
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)
mediaSource = f.createMediaSource(mediaItem!!)
}
}

private fun play() {
Expand Down Expand Up @@ -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")
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down Expand Up @@ -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()
}
}
Expand Down
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 8 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/3020149.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit dc144a5

Please sign in to comment.