플레이어 재생 완료
- 다음 재생할 콘텐츠가 없을 때 서비스를 종료해 플레이어에서 재생 및 이전/다음 콘텐츠 재생이 안되는 버그 수정
This commit is contained in:
parent
8867fe9a1c
commit
a7f67dc72e
|
@ -14,6 +14,17 @@
|
|||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1280" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="OPPO" />
|
||||
<option name="codename" value="OP573DL1" />
|
||||
<option name="id" value="OP573DL1" />
|
||||
<option name="manufacturer" value="OPPO" />
|
||||
<option name="name" value="CPH2557" />
|
||||
<option name="screenDensity" value="480" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="28" />
|
||||
<option name="brand" value="DOCOMO" />
|
||||
|
|
|
@ -236,7 +236,11 @@ class AudioContentPlayerFragment(
|
|||
override fun onPlaybackStateChanged(playbackState: Int) {
|
||||
mediaController?.let {
|
||||
when (playbackState) {
|
||||
Player.STATE_ENDED -> it.seekTo(0)
|
||||
Player.STATE_ENDED -> {
|
||||
it.seekTo(0)
|
||||
it.pause()
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,8 +104,6 @@ class AudioContentPlayerService : MediaSessionService() {
|
|||
} else if (playbackState == Player.STATE_ENDED) {
|
||||
if (playlistManager!!.hasNextContent()) {
|
||||
playNextContent()
|
||||
} else {
|
||||
onStopService()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -267,8 +265,8 @@ class AudioContentPlayerService : MediaSessionService() {
|
|||
content.id,
|
||||
onSuccess = { urlGenerateSuccess(content, it) },
|
||||
onFailure = {
|
||||
if (playlistManager!!.hasNextContent()) {
|
||||
playNextContent()
|
||||
if (playlistManager!!.hasPreviousContent()) {
|
||||
playPreviousContent()
|
||||
} else {
|
||||
onStopService()
|
||||
}
|
||||
|
@ -291,7 +289,7 @@ class AudioContentPlayerService : MediaSessionService() {
|
|||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
{
|
||||
if (it.success && it.data != null) {
|
||||
if (it.success && it.data != null && it.data.contentUrl.isNotBlank()) {
|
||||
onSuccess(it.data.contentUrl)
|
||||
} else {
|
||||
onFailure()
|
||||
|
|
|
@ -24,4 +24,8 @@ class AudioContentPlaylistManager(private val playlist: List<AudioContentPlaylis
|
|||
fun hasNextContent(): Boolean {
|
||||
return currentIndex + 1 < playlist.size
|
||||
}
|
||||
|
||||
fun hasPreviousContent(): Boolean {
|
||||
return currentIndex - 1 > 0
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue