Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
9c0d4c6f
Commit
9c0d4c6f
authored
Dec 24, 2019
by
严久程
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
课程播放可音视频切换、播放器升级
parent
8ad4332f
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
163 additions
and
60 deletions
+163
-60
config.gradle
config.gradle
+4
-4
CoursePlayActivity.kt
m-course/src/main/java/com/yidianling/course/coursePlay/CoursePlayActivity.kt
+68
-34
CoursePlayItemViewAudio.kt
m-course/src/main/java/com/yidianling/course/coursePlay/CoursePlayItemViewAudio.kt
+15
-2
CoursePlayItemViewVideo.kt
m-course/src/main/java/com/yidianling/course/coursePlay/CoursePlayItemViewVideo.kt
+36
-2
PlayViewInterface.kt
m-course/src/main/java/com/yidianling/course/coursePlay/PlayViewInterface.kt
+7
-1
HPlayView.kt
m-course/src/main/java/com/yidianling/course/widget/HPlayView.kt
+6
-9
activity_course_play.xml
m-course/src/main/res/layout/activity_course_play.xml
+2
-2
course_play_music_view.xml
m-course/src/main/res/layout/course_play_music_view.xml
+2
-2
course_videoplay_view.xml
m-course/src/main/res/layout/course_videoplay_view.xml
+1
-1
AudioPlayer.kt
ydl-media/src/main/java/com/ydl/media/audio/AudioPlayer.kt
+22
-3
No files found.
config.gradle
View file @
9c0d4c6f
ext
{
kotlin_version
=
"1.3.21"
dev_mode
=
fals
e
dev_mode
=
tru
e
ydl_app
=
[
appName
:
"心理咨询壹点灵"
,
...
...
@@ -53,7 +53,7 @@ ext {
"m-muse"
:
"0.0.20.8"
,
"m-tests"
:
"0.0.15.8"
,
"m-course"
:
"0.0.34.1
0
"
,
"m-course"
:
"0.0.34.1
2
"
,
//-------------- 业务模块 API 层 --------------
"m-audioim-api"
:
"0.0.5"
,
...
...
@@ -100,7 +100,7 @@ ext {
"m-muse"
:
"0.0.20.7"
,
"m-tests"
:
"0.0.15.7"
,
"m-course"
:
"0.0.34.
7
"
,
"m-course"
:
"0.0.34.
10
"
,
//-------------- 业务模块 API 层 --------------
"m-audioim-api"
:
"0.0.5"
,
"m-confide-api"
:
"0.0.1.1"
,
...
...
@@ -225,7 +225,7 @@ ext {
"systembartint"
:
"com.readystatesoftware.systembartint:systembartint:1.0.3"
,
"cube"
:
"in.srain.cube:cube-sdk:1.0.44@aar"
,
"support-multidex"
:
"com.android.support:multidex:1.0.2"
,
"ydl-ijkplayer-jjdxm"
:
"com.ydl:jjdxm-ijkplayer:0.0.
3
"
,
"ydl-ijkplayer-jjdxm"
:
"com.ydl:jjdxm-ijkplayer:0.0.
4
"
,
"robust"
:
"com.meituan.robust:robust:0.4.87"
,
"walle"
:
"com.meituan.android.walle:library:1.1.5"
,
"jpush"
:
"cn.jiguang.sdk:jpush:3.3.6"
,
...
...
m-course/src/main/java/com/yidianling/course/coursePlay/CoursePlayActivity.kt
View file @
9c0d4c6f
...
...
@@ -42,7 +42,6 @@ import com.ydl.ydlcommon.view.BaseViewHolder
import
com.ydl.ydlcommon.view.dialog.CommonDialog
import
com.ydl.ydlcommon.view.dialog.YDLShareDialog
import
com.yidianling.common.tools.RxImageTool
import
com.yidianling.common.tools.RxNetTool
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.course.BuildConfig
import
com.yidianling.course.R
...
...
@@ -242,34 +241,33 @@ class CoursePlayActivity : BaseActivity() {
0
)
index
=
position
if
(
playList
[
index
].
mediaType
==
2
)
{
play_type
=
1
(
playVideoView
as
CoursePlayItemViewVideo
)
?.
play
(
position
)
}
if
(
playList
[
index
].
mediaType
==
1
)
{
play_type
=
0
if
(
RxNetTool
.
isWifi
(
this
@CoursePlayActivity
))
{
(
playAudioView
as
CoursePlayItemViewAudio
).
playView
!!
.
play
(
position
)
}
else
{
if
((
playAudioView
as
CoursePlayItemViewAudio
).
hasEnsureNetStatus
)
{
(
playAudioView
as
CoursePlayItemViewAudio
).
playView
!!
.
play
(
position
)
}
else
{
(
playAudioView
as
CoursePlayItemViewAudio
).
setData
(
position
,
playList
,
courPlayBean
!!
.
courseExtra
,
from
)
}
}
}
adapter
?.
notifyDataSetChanged
()
updatePlayingListStatus
(
position
)
// if (playList[index].mediaType == 2) {
// play_type = 1
// (playVideoView as CoursePlayItemViewVideo)?.play(position)
// }
// if (playList[index].mediaType == 1) {
// play_type = 0
// if (RxNetTool.isWifi(this@CoursePlayActivity)) {
// (playAudioView as CoursePlayItemViewAudio).playView!!.play(
// position
// )
// } else {
// if ((playAudioView as CoursePlayItemViewAudio).hasEnsureNetStatus) {
// (playAudioView as CoursePlayItemViewAudio).playView!!.play(
// position
// )
// } else {
// (playAudioView as CoursePlayItemViewAudio).setData(
// position,
// playList,
// courPlayBean!!.courseExtra,
// from
// )
// }
// }
// }
// adapter?.notifyDataSetChanged()
}
}
}
...
...
@@ -438,6 +436,9 @@ class CoursePlayActivity : BaseActivity() {
// frame_audio_play.addView(playAudioView as CoursePlayItemViewVideo)
// }
//专家简介部分
headview
?.
setData
(
bean
.
courseExtra
)
//视频
playVideoView
=
CoursePlayItemViewVideo
.
create
(
this
,
play_type
)
(
playVideoView
as
CoursePlayItemViewVideo
).
hasEnsureNetStatus
=
isCancelNetCheck
...
...
@@ -446,23 +447,25 @@ class CoursePlayActivity : BaseActivity() {
//音频
playAudioView
=
CoursePlayItemViewAudio
.
create
(
this
,
play_type
)
(
playAudioView
as
CoursePlayItemViewAudio
).
hasEnsureNetStatus
=
isCancelNetCheck
frame_audio_play
.
addView
(
playAudioView
as
CoursePlayItemView
Vide
o
)
frame_audio_play
.
addView
(
playAudioView
as
CoursePlayItemView
Audi
o
)
if
(
play_type
==
0
)
{
playAudioView
?.
setData
(
index
,
playList
,
bean
.
courseExtra
,
from
)
frame_audio_play
.
visibility
=
View
.
VISIBLE
frame_video_play
.
visibility
=
View
.
GONE
}
else
{
playVideoView
?.
setData
(
index
,
playList
,
bean
.
courseExtra
,
from
)
frame_video_play
.
visibility
=
View
.
VISIBLE
frame_audio_play
.
visibility
=
View
.
GONE
}
playAudioView
?.
setData
(
index
,
playList
,
bean
.
courseExtra
,
from
,
play_type
==
0
)
playVideoView
?.
setData
(
index
,
playList
,
bean
.
courseExtra
,
from
,
play_type
==
1
)
if
(
videoView
!=
null
&&
play_type
==
1
&&
fullScreen
==
1
)
{
videoView
!!
.
toggleFullScreen
()
videoView
!!
.
setNetWorkTypeTie
(
false
)
videoView
!!
.
startPlay
()
}
//专家简介部分
headview
?.
setData
(
bean
.
courseExtra
)
tv_title_full
.
text
=
bean
.
courseExtra
.
title
text_price
.
text
=
"立即购买 ¥"
+
bean
.
courseExtra
.
applyFee
...
...
@@ -501,18 +504,49 @@ class CoursePlayActivity : BaseActivity() {
fun
updatePlayingListStatus
(
index
:
Int
)
{
if
(
index
<
playList
.
size
&&
this
.
index
!=
index
)
{
if
(!
playList
[
index
].
isDemo
&&
!
courPlayBean
!!
.
courseExtra
.
isBuy
)
{
if
(
AudioPlayer
.
get
().
isPlaying
)
{
AudioPlayer
.
get
().
playPause
()
}
if
(
videoView
!=
null
)
{
videoView
?.
pausePlay
()
}
CommonDialog
(
this
@CoursePlayActivity
)
.
setMessage
(
"\n购买课程,获取完整课程内容\n"
)
.
setLeftOnclick
(
"放弃"
)
{
}
.
setRightClick
(
"购买"
)
{
//跳转支付页
addCourseOrder
()
}
.
setCancelAble
(
false
)
.
show
()
return
}
if
(
playList
[
index
].
mediaType
==
1
)
{
play_type
=
0
frame_video_play
.
visibility
=
View
.
GONE
frame_audio_play
.
visibility
=
View
.
VISIBLE
(
playAudioView
as
CoursePlayItemViewAudio
).
playView
?.
play
(
index
)
if
(
videoView
!=
null
)
{
videoView
?.
pausePlay
()
}
}
if
(
playList
[
index
].
mediaType
==
2
)
{
play_type
=
1
frame_video_play
.
visibility
=
View
.
VISIBLE
frame_audio_play
.
visibility
=
View
.
GONE
(
playVideoView
as
CoursePlayItemViewVideo
)
?.
play
(
index
)
if
(
AudioPlayer
.
get
().
isPlaying
)
{
AudioPlayer
.
get
().
playPause
()
}
}
this
.
index
=
index
...
...
m-course/src/main/java/com/yidianling/course/coursePlay/CoursePlayItemViewAudio.kt
View file @
9c0d4c6f
...
...
@@ -106,7 +106,8 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface {
index
:
Int
,
list
:
ArrayList
<
CourseMediaBean
>,
courseExtra
:
CourseExtraBean
,
from
:
Int
from
:
Int
,
isAutoPlay
:
Boolean
)
{
if
(
list
.
isEmpty
())
return
...
...
@@ -135,10 +136,14 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface {
if
(
TextUtils
.
equals
(
playView
?.
getCurrentUrl
(),
list
[
currentIndex
].
url
))
{
playView
?.
updateView
(
currentIndex
)
}
else
{
if
(
isAutoPlay
){
playView
?.
play
(
currentIndex
)
}
}
}
else
{
playView
?.
play
(
index
)
if
(
isAutoPlay
){
playView
?.
play
(
currentIndex
)
}
}
}
else
{
if
(
hasEnsureNetStatus
)
{
...
...
@@ -146,11 +151,15 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface {
if
(
TextUtils
.
equals
(
playView
?.
getCurrentUrl
(),
list
[
currentIndex
].
url
))
{
playView
?.
updateView
(
currentIndex
)
}
else
{
if
(
isAutoPlay
){
playView
?.
play
(
currentIndex
)
}
}
}
else
{
if
(
isAutoPlay
){
playView
?.
play
(
currentIndex
)
}
}
}
else
{
playView
?.
showNetNotice
{
hasEnsureNetStatus
=
true
...
...
@@ -158,15 +167,19 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface {
if
(
TextUtils
.
equals
(
playView
?.
getCurrentUrl
(),
list
[
currentIndex
].
url
))
{
playView
?.
updateView
(
currentIndex
)
}
else
{
if
(
isAutoPlay
){
playView
?.
play
(
currentIndex
)
}
}
}
else
{
if
(
isAutoPlay
){
playView
?.
play
(
currentIndex
)
}
}
}
}
}
}
//将列表转为播放器可用列表
private
fun
stringToMusicPlayerList
(
list
:
List
<
CourseMediaBean
>):
ArrayList
<
Music
>
{
...
...
m-course/src/main/java/com/yidianling/course/coursePlay/CoursePlayItemViewVideo.kt
View file @
9c0d4c6f
...
...
@@ -160,12 +160,13 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface {
var
url
=
playList
[
index
].
url
url
=
url
.
replace
(
"https"
,
"http"
)
//
url = url.replace("https", "http")
videoUrl
=
url
var
hisTime
=
PlayProgressUtil
.
getProgress
(
context
,
url
)
try
{
activity
?.
videoView
=
PlayerView
(
activity
)
.
setScaleType
(
PlayStateParams
.
fitparent
)
.
hideMenu
(
true
)
...
...
@@ -178,6 +179,10 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface {
.
setOnInfoListener
(
object
:
IMediaPlayer
.
OnInfoListener
{
override
fun
onInfo
(
mp
:
IMediaPlayer
,
what
:
Int
,
extra
:
Int
):
Boolean
{
LogUtil
.
e
(
"课程播放--状态-$what"
)
if
(
what
==
PlayStateParams
.
MEDIA_INFO_VIDEO_INTERRUPT
)
{
activity
?.
videoView
?.
startPlay
()
}
if
(
what
==
PlayStateParams
.
STATE_PAUSED
)
{
this
@CoursePlayItemViewVideo
.
findViewById
<
View
>(
R
.
id
.
rl_play_pause_layout
)
.
visibility
=
View
.
VISIBLE
...
...
@@ -218,6 +223,10 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface {
this
@CoursePlayItemViewVideo
.
index
=
this
@CoursePlayItemViewVideo
.
index
+
1
activity
!!
.
updatePlayingListStatus
(
this
@CoursePlayItemViewVideo
.
index
)
this
@CoursePlayItemViewVideo
.
findViewById
<
View
>(
R
.
id
.
ll_loading
)
.
visibility
=
View
.
VISIBLE
this
@CoursePlayItemViewVideo
.
findViewById
<
View
>(
R
.
id
.
app_video_loading
)
.
visibility
=
View
.
VISIBLE
}
}
else
{
isVideoPlaying
=
true
...
...
@@ -236,6 +245,28 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface {
.
setPlaySource
(
url
)
.
startPlay
()
.
seekTo
(
hisTime
)
// try {
// var videoViewField =
// activity?.videoView.run { javaClass.getDeclaredField("videoView") }
// videoViewField.isAccessible = true
//
// var ijkVideoView = videoViewField.get(activity?.videoView) as IjkVideoView
// var mMediaPlayerField = ijkVideoView.javaClass.getDeclaredField("mMediaPlayer")
//
// var mMediaPlayerObject = mMediaPlayerField.get(ijkVideoView)
// if (mMediaPlayerObject is IjkMediaPlayer) {
// mMediaPlayerObject.setOption(
// IjkMediaPlayer.OPT_CATEGORY_FORMAT,
// "dns_cache_clear",
// 1
// )
// }
// } catch (e: java.lang.Exception) {
//
// }
//
// activity?.videoView?.startPlay()?.seekTo(hisTime)
val
layout
=
activity
?.
window
?.
attributes
layout
?.
screenBrightness
=
-
1f
activity
?.
window
?.
attributes
=
layout
...
...
@@ -253,15 +284,18 @@ class CoursePlayItemViewVideo : RelativeLayout, PlayViewInterface {
index
:
Int
,
list
:
ArrayList
<
CourseMediaBean
>,
courseExtra
:
CourseExtraBean
,
from
:
Int
from
:
Int
,
isAutoPlay
:
Boolean
)
{
if
(
list
.
isEmpty
())
return
playList
.
clear
()
playList
.
addAll
(
list
)
this
.
courseExtra
=
courseExtra
if
(
isAutoPlay
)
{
play
(
index
)
}
}
override
fun
onDestroy
()
{
timer
.
cancel
()
...
...
m-course/src/main/java/com/yidianling/course/coursePlay/PlayViewInterface.kt
View file @
9c0d4c6f
...
...
@@ -18,7 +18,13 @@ interface PlayViewInterface {
fun
onDestroy
()
//from 1表示通知栏进来,2表示悬浮按钮进来 index:播放下标
fun
setData
(
index
:
Int
,
list
:
ArrayList
<
CourseMediaBean
>,
courseExtra
:
CourseExtraBean
,
from
:
Int
)
fun
setData
(
index
:
Int
,
list
:
ArrayList
<
CourseMediaBean
>,
courseExtra
:
CourseExtraBean
,
from
:
Int
,
isAutoPlay
:
Boolean
=
true
)
fun
onNewIntent
()
...
...
m-course/src/main/java/com/yidianling/course/widget/HPlayView.kt
View file @
9c0d4c6f
...
...
@@ -40,7 +40,7 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
View
.
inflate
(
context
,
R
.
layout
.
course_play_music_view
,
this
)
AudioPlayer
.
get
().
addOnPlayEventListener
(
this
)
play_icon
.
setOnClickListener
{
course_audio_
play_icon
.
setOnClickListener
{
AudioPlayer
.
get
().
playPause
()
}
img_gif
.
setOnClickListener
{
...
...
@@ -91,9 +91,6 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
return
this
}
/**
* 后台进入前台view
*/
fun
updateView
(
index
:
Int
)
{
if
(
AudioPlayer
.
get
().
isPlaying
)
{
mHandler
?.
postDelayed
({
...
...
@@ -139,7 +136,7 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
if
(
mContext
!=
null
)
{
Glide
.
with
(
mContext
).
asGif
().
load
(
R
.
drawable
.
course_loading5
).
into
(
img_gif
)
}
play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_play
)
course_audio_
play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_play
)
pro_progress
.
progress
=
0
text_start_time
.
text
=
"00:00"
...
...
@@ -195,13 +192,13 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
if
(
mContext
!=
null
)
{
Glide
.
with
(
mContext
).
asGif
().
load
(
R
.
drawable
.
course_loading5
).
into
(
img_gif
)
}
play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_play
)
course_audio_
play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_play
)
}
}
else
{
if
(
mContext
!=
null
)
{
Glide
.
with
(
mContext
).
asGif
().
load
(
R
.
drawable
.
course_audio_play
).
into
(
img_gif
)
}
play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_pause
)
course_audio_
play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_pause
)
}
},
0
)
}
...
...
@@ -212,11 +209,11 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
mHandler
?.
postDelayed
({
if
(
show
)
{
Glide
.
with
(
mContext
).
asGif
().
load
(
R
.
drawable
.
course_audio_play
).
into
(
img_gif
)
play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_pause
)
course_audio_
play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_pause
)
}
else
{
Glide
.
with
(
mContext
).
asBitmap
().
load
(
R
.
drawable
.
course_ico_course_bg_pause
)
.
into
(
img_gif
)
play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_play
)
course_audio_
play_icon
.
setImageResource
(
R
.
drawable
.
course_ico_course_play
)
}
},
0
)
}
...
...
m-course/src/main/res/layout/activity_course_play.xml
View file @
9c0d4c6f
...
...
@@ -44,14 +44,14 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/transparent"
android:visibility=
"
gon
e"
/>
android:visibility=
"
visibl
e"
/>
<FrameLayout
android:id=
"@+id/frame_video_play"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/transparent"
android:visibility=
"
gon
e"
/>
android:visibility=
"
visibl
e"
/>
</FrameLayout>
<RelativeLayout
...
...
m-course/src/main/res/layout/course_play_music_view.xml
View file @
9c0d4c6f
...
...
@@ -38,7 +38,7 @@
android:layout_marginBottom=
"15dp"
>
<ImageView
android:id=
"@+id/play_icon"
android:id=
"@+id/
course_audio_
play_icon"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_centerVertical=
"true"
...
...
@@ -54,7 +54,7 @@
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"-3dp"
android:layout_toLeftOf=
"@+id/text_start_time"
android:layout_toRightOf=
"@+id/play_icon"
android:layout_toRightOf=
"@+id/
course_audio_
play_icon"
android:maxHeight=
"2dp"
android:minHeight=
"2dp"
android:progressDrawable=
"@drawable/course_layer_progress"
...
...
m-course/src/main/res/layout/course_videoplay_view.xml
View file @
9c0d4c6f
...
...
@@ -149,7 +149,7 @@
android:layout_height=
"40dp"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"3dp"
android:padding=
"
1
dp"
android:padding=
"
3
dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/course_ico_course_play"
/>
...
...
ydl-media/src/main/java/com/ydl/media/audio/AudioPlayer.kt
View file @
9c0d4c6f
...
...
@@ -13,6 +13,7 @@ import com.ydl.media.audio.manager.NotifyManager
import
com.ydl.media.audio.model.Music
import
com.ydl.media.audio.receiver.NoisyAudioStreamReceiver
import
com.ydl.media.audio.utils.PlayProgressUtil
import
com.ydl.ydlcommon.utils.LogUtil
import
com.yidianling.common.tools.ToastUtil
import
tv.danmaku.ijk.media.player.IMediaPlayer
import
tv.danmaku.ijk.media.player.IjkMediaPlayer
...
...
@@ -45,7 +46,11 @@ class AudioPlayer private constructor() {
var
percent
=
(
current
*
100
/
du
).
toInt
()
//保存进度
if
(
autoSaveProgress
)
{
PlayProgressUtil
.
saveProgress
(
context
,
playMusic
!!
.
path
,
(
if
(
percent
==
99
||
percent
==
100
)
0
else
current
.
toInt
()))
PlayProgressUtil
.
saveProgress
(
context
,
playMusic
!!
.
path
,
(
if
(
percent
==
99
||
percent
==
100
)
0
else
current
.
toInt
())
)
}
for
(
listener
in
listeners
)
{
listener
.
onPublish
(
percent
,
current
.
toLong
())
...
...
@@ -115,6 +120,16 @@ class AudioPlayer private constructor() {
this
.
context
=
context
.
applicationContext
audioFocusManager
=
AudioFocusManager
(
context
)
mediaPlayer
=
IjkMediaPlayer
()
try
{
(
mediaPlayer
as
IjkMediaPlayer
).
setOption
(
IjkMediaPlayer
.
OPT_CATEGORY_FORMAT
,
"dns_cache_clear"
,
1
)
}
catch
(
e
:
Exception
)
{
LogUtil
.
e
(
e
.
message
)
}
mediaPlayer
!!
.
setOnPreparedListener
{
mp
->
if
(
isPreparing
)
{
if
(
autoSaveProgress
)
{
...
...
@@ -340,7 +355,7 @@ class AudioPlayer private constructor() {
mediaPlayer
!!
.
pause
()
state
=
STATE_PAUSE
handler
!!
.
removeCallbacks
(
mPublishRunnable
)
if
(
isShowNotify
)
{
if
(
isShowNotify
)
{
NotifyManager
.
get
().
showPause
(
playMusic
)
MediaSessionManager
.
get
().
updatePlaybackState
()
}
...
...
@@ -425,7 +440,11 @@ class AudioPlayer private constructor() {
mediaPlayer
!!
.
seekTo
(
currentPosition
)
MediaSessionManager
.
get
().
updatePlaybackState
()
if
(
autoSaveProgress
)
{
PlayProgressUtil
.
saveProgress
(
context
,
musicList
[
playPosition
].
coverPath
,
currentPosition
.
toInt
())
PlayProgressUtil
.
saveProgress
(
context
,
musicList
[
playPosition
].
coverPath
,
currentPosition
.
toInt
()
)
}
for
(
listener
in
listeners
)
{
listener
.
onPublish
(
currentPercent
,
currentPosition
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment