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