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
caed21b3
Commit
caed21b3
authored
Nov 19, 2019
by
严久程
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
音视频播放
parent
866feac3
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
19 deletions
+66
-19
DemoAppLifecycles.java
app/src/main/java/com/ydl/component/base/DemoAppLifecycles.java
+3
-0
PlayFragment.java
app/src/main/java/com/ydl/component/music/PlayFragment.java
+3
-1
CoursePlayActivity.kt
m-course/src/main/java/com/yidianling/course/coursePlay/CoursePlayActivity.kt
+8
-15
CoursePlayLifecycle.kt
m-course/src/main/java/com/yidianling/course/lifeCallback/CoursePlayLifecycle.kt
+48
-0
VideoFloatHelper.kt
m-course/src/main/java/com/yidianling/course/widget/VideoFloatHelper.kt
+4
-3
No files found.
app/src/main/java/com/ydl/component/base/DemoAppLifecycles.java
View file @
caed21b3
...
...
@@ -9,6 +9,7 @@ import com.ydl.devicesidlib.DeviceIDHelper;
import
com.ydl.media.audio.PlayService
;
import
com.ydl.ydlcommon.base.delegate.IAppLifecycles
;
import
com.ydl.ydlcommon.utils.YdlBuryPointUtil
;
import
com.yidianling.course.lifeCallback.CoursePlayLifecycle
;
import
org.jetbrains.annotations.NotNull
;
...
...
@@ -37,6 +38,8 @@ public class DemoAppLifecycles implements IAppLifecycles {
Intent
intent
=
new
Intent
(
application
,
PlayService
.
class
);
application
.
startService
(
intent
);
application
.
registerActivityLifecycleCallbacks
(
new
CoursePlayLifecycle
());
}
@Override
...
...
app/src/main/java/com/ydl/component/music/PlayFragment.java
View file @
caed21b3
...
...
@@ -20,7 +20,9 @@ import com.ydl.media.audio.model.Music;
import
com.ydl.media.audio.utils.CoverImageUtils
;
import
com.ydl.media.view.PlayTypeEnum
;
import
com.ydl.media.view.PlayerFloatHelper
;
import
com.ydl.ydlcommon.utils.LogUtil
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.user.LoginUtils
;
import
java.util.HashMap
;
import
java.util.Locale
;
...
...
@@ -291,6 +293,6 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
@Override
public
void
onComplete
()
{
LogUtil
.
e
(
"onComplete"
);
}
}
m-course/src/main/java/com/yidianling/course/coursePlay/CoursePlayActivity.kt
View file @
caed21b3
...
...
@@ -20,6 +20,7 @@ import com.alibaba.android.arouter.facade.annotation.Route
import
com.bumptech.glide.Glide
import
com.dou361.ijkplayer.widget.PlayStateParams
import
com.dou361.ijkplayer.widget.PlayerView
import
com.lzf.easyfloat.enums.ShowPattern
import
com.lzf.easyfloat.permission.PermissionUtils
import
com.ydl.media.audio.AudioPlayer
import
com.ydl.media.audio.utils.PlayProgressUtil
...
...
@@ -495,12 +496,6 @@ class CoursePlayActivity : BaseActivity() {
}
}
fun
showPlayAnim
(
isShowAnim
:
Boolean
)
{
this
.
isShowAnim
=
isShowAnim
if
(
adapter
!=
null
)
{
adapter
?.
notifyDataSetChanged
()
}
}
fun
showLoadingDialog
()
{
...
...
@@ -643,11 +638,12 @@ class CoursePlayActivity : BaseActivity() {
val
hashMap
=
HashMap
<
String
,
String
>()
hashMap
[
"course_id"
]
=
course_id
.
toString
()
PlayerFloatHelper
.
show
(
this
,
playTypeEnum
=
PlayTypeEnum
.
PLAY_TYPE_COURSE
,
playData
=
hashMap
)
PlayerFloatHelper
.
playTempData
.
putAll
(
hashMap
)
// PlayerFloatHelper.show(
// this,
// playTypeEnum = PlayTypeEnum.PLAY_TYPE_COURSE,
// playData = hashMap
// )
}
...
...
@@ -668,16 +664,13 @@ class CoursePlayActivity : BaseActivity() {
// YDLMusicHelper.courseVideoUlr = (play_view as CoursePlayItemViewVideo).videoUrl
// YDLMusicHelper.course_id = courPlayBean?.courseExtra?.id!!.toInt()
VideoFloatHelper
.
setVideoInfo
(
course_id
.
toString
(),
(
play_view
as
CoursePlayItemViewVideo
).
videoUrl
!!
,
true
)
VideoFloatHelper
.
defaultShowPattern
=
ShowPattern
.
FOREGROUND
checkPermission
()
}
}
}
...
...
m-course/src/main/java/com/yidianling/course/lifeCallback/CoursePlayLifecycle.kt
0 → 100644
View file @
caed21b3
package
com.yidianling.course.lifeCallback
import
android.app.Activity
import
android.app.Application
import
android.os.Bundle
import
com.ydl.media.audio.AudioPlayer
import
com.ydl.media.view.PlayTypeEnum
import
com.ydl.media.view.PlayerFloatHelper
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/11/19
*/
class
CoursePlayLifecycle
:
Application
.
ActivityLifecycleCallbacks
{
override
fun
onActivityPaused
(
activity
:
Activity
?)
{
}
override
fun
onActivityResumed
(
activity
:
Activity
?)
{
if
(!
PlayerFloatHelper
.
isCanClick
)
{
PlayerFloatHelper
.
hide
()
PlayerFloatHelper
.
removeView
(
activity
!!
)
AudioPlayer
.
get
().
stopPlayer
()
}
else
{
PlayerFloatHelper
.
showIfPlaying
(
activity
!!
)
PlayerFloatHelper
.
playingType
=
PlayTypeEnum
.
PLAY_TYPE_COURSE
}
}
override
fun
onActivityStarted
(
activity
:
Activity
?)
{
}
override
fun
onActivityDestroyed
(
activity
:
Activity
?)
{
}
override
fun
onActivitySaveInstanceState
(
activity
:
Activity
?,
outState
:
Bundle
?)
{
}
override
fun
onActivityStopped
(
activity
:
Activity
?)
{
}
override
fun
onActivityCreated
(
activity
:
Activity
?,
savedInstanceState
:
Bundle
?)
{
}
}
\ No newline at end of file
m-course/src/main/java/com/yidianling/course/widget/VideoFloatHelper.kt
View file @
caed21b3
...
...
@@ -12,6 +12,7 @@ import com.dou361.ijkplayer.widget.PlayerView
import
com.lzf.easyfloat.EasyFloat
import
com.lzf.easyfloat.enums.ShowPattern
import
com.lzf.easyfloat.interfaces.OnInvokeView
import
com.ydl.media.audio.utils.PlayProgressUtil
import
com.yidianling.common.tools.RxDeviceTool
import
com.yidianling.common.tools.RxImageTool
import
com.yidianling.course.R
...
...
@@ -90,7 +91,7 @@ object VideoFloatHelper {
private
fun
initVideoPlayer
(
activity
:
Activity
,
view
:
View
)
{
val
url
=
courseVideoUrl
.
replace
(
"https"
,
"http"
)
val
hisTime
=
Video
ProgressUtil
.
getProgress
(
activity
,
url
)
val
hisTime
=
Play
ProgressUtil
.
getProgress
(
activity
,
url
)
videoView
=
PlayerView
(
activity
,
view
)
.
setScaleType
(
PlayStateParams
.
fitparent
)
.
hideAllUI
()
...
...
@@ -100,7 +101,7 @@ object VideoFloatHelper {
.
setOnInfoListener
{
_
,
what
,
_
->
if
(
what
==
PlayStateParams
.
STATE_COMPLETED
)
{
isCurrentVideoPlaying
=
false
Video
ProgressUtil
.
saveProgress
(
activity
,
url
,
0
)
Play
ProgressUtil
.
saveProgress
(
activity
,
url
,
0
)
}
else
{
isCurrentVideoPlaying
=
true
}
...
...
@@ -130,7 +131,7 @@ object VideoFloatHelper {
if
(
isCurrentVideoPlaying
)
{
var
time
=
videoView
?.
currentPosition
?:
0
if
(
time
<
3000
)
return
Video
ProgressUtil
.
saveProgress
(
activity
,
url
,
time
)
Play
ProgressUtil
.
saveProgress
(
activity
,
url
,
time
)
}
}
},
1000
,
1000
)
...
...
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