Commit d78288df by 刘鹏

Merge remote-tracking branch 'origin/d/v4.3.96' into d/v4.3.97

# Conflicts:
#	config.gradle
parents 519d6148 e161c2b0
......@@ -5,7 +5,7 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.50.21",
"m-confide" : "0.0.50.24",
"m-consultant" : "0.0.60.67",
"m-fm" : "0.0.30.09",
"m-user" : "0.0.62.48",
......@@ -14,7 +14,7 @@ ext {
"m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.10",
"m-muse" : "0.0.28.76",
"m-muse" : "0.0.28.78",
"m-tests" : "0.0.24.18",
"m-course" : "0.0.43.39",
......@@ -42,7 +42,8 @@ ext {
"ydl-webview" : "0.0.38.92",
"ydl-media" : "0.0.21.52",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.30.15",
"m-audioim" : "0.0.49.30.18",
......@@ -93,7 +94,7 @@ ext {
ydlCompileVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.50.21",
"m-confide" : "0.0.50.24",
"m-consultant" : "0.0.60.67",
"m-fm" : "0.0.30.09",
"m-user" : "0.0.62.48",
......@@ -102,7 +103,7 @@ ext {
"m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.10",
"m-muse" : "0.0.28.76",
"m-muse" : "0.0.28.78",
"m-tests" : "0.0.24.18",
"m-course" : "0.0.43.39",
......@@ -129,7 +130,7 @@ ext {
"ydl-webview" : "0.0.38.92",
"ydl-media" : "0.0.21.52",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.30.15",
"m-audioim" : "0.0.49.30.18",
"ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动
......
......@@ -138,40 +138,79 @@ class PlayMeditationActivity : BaseActivity() {
if (it.code.equals("200") && it.data != null) {
val module = it.data
mMediaId = module.mediaId
mediaListLink = module.playDetailUrl?:""
val mediaList = module.mediaList
if(!mediaList.isNullOrEmpty()){
val meditation = mediaList[0]
currentMeditation = meditation.copy(meditationType = mMeditationType,meditationId = mMeditationId!!)
mTitle = meditation.title
mDesc = meditation.desc?:""
mMediaUrl = meditation.mediaUrl
mMediaCoverUrl = meditation.coverImageUrl
val currentPosition = meditation.broadcastTime
mBusinessType = meditation.businessType
mBuried = meditation.buried
mStatus = meditation.status
collected = mStatus == 1
updateUI()
initMediaPlayer(
mMediaUrl,
currentPosition,
mMediaIdFromLocal == mMediaId
)
//快进点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_PAGE_VISIT,
currentMeditation?.title ?: "",
mBuried ?: "",
""
)
meditations.clear()
module.mediaList?.forEach { meditationPlayBean ->
meditations.add(meditationPlayBean)
if (meditationPlayBean.mediaId == mMediaId) {
currentMeditation =
meditationPlayBean.copy(meditationType = mMeditationType,meditationId = mMeditationId!!)
mMediaId = module?.mediaId ?: 0L
mTitle = meditationPlayBean.title
mDesc = meditationPlayBean.desc ?: ""
mMediaCoverUrl = meditationPlayBean.coverImageUrl
mMediaUrl = meditationPlayBean.mediaUrl
val currentPosition = meditationPlayBean.broadcastTime
mBusinessType = meditationPlayBean.businessType
mStatus = meditationPlayBean.status
mBuried = meditationPlayBean.buried
collected = mStatus == 1
updateUI()
initMediaPlayer(mMediaUrl, currentPosition,mMediaIdFromLocal == mMediaId)
}
}
// mediaListLink = module.playDetailUrl?:""
//
// val mediaList = module.mediaList
// if(!mediaList.isNullOrEmpty()){
// val meditation = mediaList[0]
//
//
//
// currentMeditation = meditation.copy(meditationType = mMeditationType,meditationId = mMeditationId!!)
// mTitle = meditation.title
// mDesc = meditation.desc?:""
// mMediaUrl = meditation.mediaUrl
// mMediaCoverUrl = meditation.coverImageUrl
// val currentPosition = meditation.broadcastTime
// mBusinessType = meditation.businessType
// mBuried = meditation.buried
// mStatus = meditation.status
//
// collected = mStatus == 1
//
// updateUI()
//
// initMediaPlayer(
// mMediaUrl,
// currentPosition,
// mMediaIdFromLocal == mMediaId
// )
//
// //快进点击事件
// ActionCountUtils.baiDuCountSign3(
// MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
// MuseBIConstants.YDL_MUSE_PLAY_PAGE_VISIT,
// currentMeditation?.title ?: "",
// mBuried ?: "",
// ""
// )
// }
}
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
......@@ -284,8 +323,6 @@ class PlayMeditationActivity : BaseActivity() {
)
if (!mediaListLink.isNullOrBlank()) {
ChooseMusicActivity.launch(this, H5Params(mediaListLink,"") )
// val chooseMusicDialog = ChooseMusicDialog(this,H5Params(mediaListLink!!, null))
// chooseMusicDialog.show()
}
}
......@@ -571,7 +608,7 @@ class PlayMeditationActivity : BaseActivity() {
updateUI(needRefresh = false)
initMediaPlayer(mMediaUrl, currentPosition, mMediaIdFromLocal == mMediaId)
initMediaPlayer(mMediaUrl, 0, mMediaIdFromLocal == mMediaId)
} else {
ToastUtil.toastShort("暂无内容")
}
......@@ -621,7 +658,7 @@ class PlayMeditationActivity : BaseActivity() {
updateUI(needRefresh = false)
initMediaPlayer(mMediaUrl, currentPosition, mMediaIdFromLocal == mMediaId)
initMediaPlayer(mMediaUrl, 0, mMediaIdFromLocal == mMediaId)
} else {
ToastUtil.toastShort("暂无内容")
}
......@@ -706,7 +743,8 @@ class PlayMeditationActivity : BaseActivity() {
})
initPlayCompletionListener()
val isLoop = MediaPlayerManager.getInstance(this@PlayMeditationActivity)?.getTimeOffStatus() == true
initPlayCompletionListener(isLoop = isLoop)
MeditationFloatPermissionUtil.checkSuspendedWindowPermission(this){
......@@ -734,30 +772,10 @@ class PlayMeditationActivity : BaseActivity() {
if (isLoop){
if (isSingle || meditations.size == 1){
MediaPlayerManager
.getInstance(this)?.setAudioPath(currentMeditation?.mediaUrl?:"",isLoop = true)
switchSound()
// MediaPlayerManager.getInstance(this)?.setAudioPath(mMediaUrl)
}else{
currentMeditationIndex = meditations.indexOf(currentMeditation)
if(currentMeditationIndex == meditations.size - 1){
currentMeditationIndex = 0
}else{
currentMeditationIndex++
}
currentMeditation = meditations[currentMeditationIndex]
val event = MeditationEvent(
currentMeditation?.mediaId?.toInt()?:0,
mMeditationId?:0L,
mMeditationType?:0,
mBusinessType,
status = mStatus,
buried = mBuried?:"",
mediaUrl = currentMeditation?.mediaUrl?:"",
mediaCoverUrl = currentMeditation?.coverImageUrl?:"",
title = currentMeditation?.title?:"",
desc = currentMeditation?.desc?:""
)
EventBus.getDefault().post(event)
switchSound()
}
}
......@@ -772,6 +790,38 @@ class PlayMeditationActivity : BaseActivity() {
mMediaPlayer?.pause()
}
}
mMediaPlayer?.setOnErrorListener { mp, what, extra -> true }
}
private fun switchSound(){
var meditation:MeditationPlayModuleBean.MeditationDetail? = null
meditations?.forEachIndexed { index, meditationDetail ->
if (meditationDetail.mediaId == mMediaId){
currentMeditationIndex = index
}
}
if (mMeditationId == null || mMediaId == null) return
if (currentMeditationIndex < meditations.size - 1) {
meditation = meditations[currentMeditationIndex + 1]
} else {
meditation = meditations[0]
}
currentMeditation = meditation.copy(meditationId = mMeditationId!!)
mMediaId = meditation.mediaId
mMediaCoverUrl = meditation.coverImageUrl
mMediaUrl = meditation.mediaUrl
mStatus = meditation.status
mTitle = meditation.title
mDesc = meditation.title
updateUI(needRefresh = false)
initMediaPlayer(mMediaUrl, 0, mMediaIdFromLocal == mMediaId)
}
private fun initMediaPlayer(path: String, current: Int, isSameOne: Boolean = false) {
......@@ -787,7 +837,7 @@ class PlayMeditationActivity : BaseActivity() {
val currentPosition = mMediaPlayer?.currentPosition
duration = mMediaPlayer?.duration ?: 0
if (current > 0) {
if (current >= 0) {
seekbar_play_progress.max = duration
seekbar_play_progress.progress = current
exo_position.text = MediaPlayerTimeUtil.calculateTime(current)
......@@ -911,6 +961,14 @@ class PlayMeditationActivity : BaseActivity() {
}
}
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_PAGE_VISIT,
mTitle,
mBuried ?: "",
""
)
}
private fun initRxTimeOff(time: Long, meditationType: Int) {
......
......@@ -45,7 +45,7 @@ class MediaPlayerManager private constructor() {
mTime = time
}
fun setAudioPath(path: String,isLoop:Boolean = false){
fun setAudioPath(path: String){
val attrs = AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
......@@ -60,9 +60,6 @@ class MediaPlayerManager private constructor() {
mMediaPlayer?.prepareAsync()
mMediaPlayer?.setOnPreparedListener {
listener?.onPrepared(it)
if (isLoop){
mMediaPlayer?.seekTo(0)
}
}
}
......
......@@ -28,7 +28,7 @@ class MediaPlayerTimeUtil {
"$minute:$second"
}
}
}else if (time in 1..59){
}else if (time in 0..59){
second = time
return if (second in 0..9){
"00:0$second"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment