Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grayjay
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoStreaming
Grayjay
Commits
f224cd1c
Commit
f224cd1c
authored
1 year ago
by
Kelvin
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay
parents
d433d6e7
90de54ac
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/com/futo/platformplayer/views/video/FutoVideoPlayerBase.kt
+20
-6
20 additions, 6 deletions
...om/futo/platformplayer/views/video/FutoVideoPlayerBase.kt
with
20 additions
and
6 deletions
app/src/main/java/com/futo/platformplayer/views/video/FutoVideoPlayerBase.kt
+
20
−
6
View file @
f224cd1c
...
@@ -150,7 +150,7 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
...
@@ -150,7 +150,7 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
Logger
.
v
(
TAG
,
"Attached onConnectionAvailable listener."
);
Logger
.
v
(
TAG
,
"Attached onConnectionAvailable listener."
);
StateApp
.
instance
.
onConnectionAvailable
.
subscribe
(
_referenceObject
)
{
StateApp
.
instance
.
onConnectionAvailable
.
subscribe
(
_referenceObject
)
{
Logger
.
v
(
TAG
,
"onConnectionAvailable"
);
Logger
.
v
(
TAG
,
"onConnectionAvailable
connectivityLossTime = $_connectivityLossTime_ms, position = $position, duration = $duration
"
);
val
pos
=
position
;
val
pos
=
position
;
val
dur
=
duration
;
val
dur
=
duration
;
...
@@ -158,25 +158,37 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
...
@@ -158,25 +158,37 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
if
(
_shouldPlaybackRestartOnConnectivity
&&
abs
(
pos
-
dur
)
>
2000
)
{
if
(
_shouldPlaybackRestartOnConnectivity
&&
abs
(
pos
-
dur
)
>
2000
)
{
if
(
Settings
.
instance
.
playback
.
restartPlaybackAfterConnectivityLoss
==
1
)
{
if
(
Settings
.
instance
.
playback
.
restartPlaybackAfterConnectivityLoss
==
1
)
{
val
lossTime_ms
=
_connectivityLossTime_ms
val
lossTime_ms
=
_connectivityLossTime_ms
if
(
lossTime_ms
!=
null
&&
System
.
currentTimeMillis
()
-
lossTime_ms
<
1000
*
30
)
{
if
(
lossTime_ms
!=
null
)
{
shouldRestartPlayback
=
true
val
lossDuration_ms
=
System
.
currentTimeMillis
()
-
lossTime_ms
Logger
.
v
(
TAG
,
"onConnectionAvailable lossDuration=$lossDuration_ms"
)
if
(
lossDuration_ms
<
1000
*
10
)
{
shouldRestartPlayback
=
true
}
}
}
}
else
if
(
Settings
.
instance
.
playback
.
restartPlaybackAfterConnectivityLoss
==
2
)
{
}
else
if
(
Settings
.
instance
.
playback
.
restartPlaybackAfterConnectivityLoss
==
2
)
{
val
lossTime_ms
=
_connectivityLossTime_ms
val
lossTime_ms
=
_connectivityLossTime_ms
if
(
lossTime_ms
!=
null
&&
System
.
currentTimeMillis
()
-
lossTime_ms
<
1000
*
10
)
{
if
(
lossTime_ms
!=
null
)
{
shouldRestartPlayback
=
true
val
lossDuration_ms
=
System
.
currentTimeMillis
()
-
lossTime_ms
Logger
.
v
(
TAG
,
"onConnectionAvailable lossDuration=$lossDuration_ms"
)
if
(
lossDuration_ms
<
1000
*
30
)
{
shouldRestartPlayback
=
true
}
}
}
}
else
if
(
Settings
.
instance
.
playback
.
restartPlaybackAfterConnectivityLoss
==
3
)
{
}
else
if
(
Settings
.
instance
.
playback
.
restartPlaybackAfterConnectivityLoss
==
3
)
{
shouldRestartPlayback
=
true
shouldRestartPlayback
=
true
}
}
}
}
Logger
.
v
(
TAG
,
"onConnectionAvailable shouldRestartPlayback = $shouldRestartPlayback"
);
if
(
shouldRestartPlayback
)
{
if
(
shouldRestartPlayback
)
{
Logger
.
i
(
TAG
,
"Playback ended due to connection loss, resuming playback since connection is restored."
);
Logger
.
i
(
TAG
,
"Playback ended due to connection loss, resuming playback since connection is restored."
);
exoPlayer
?.
player
?.
playWhenReady
=
true
;
exoPlayer
?.
player
?.
playWhenReady
=
true
;
exoPlayer
?.
player
?.
prepare
();
exoPlayer
?.
player
?.
prepare
();
exoPlayer
?.
player
?.
play
();
exoPlayer
?.
player
?.
play
();
}
}
_connectivityLossTime_ms
=
null
;
};
};
}
}
...
@@ -524,6 +536,8 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
...
@@ -524,6 +536,8 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
}
}
protected
open
fun
onPlayerError
(
error
:
PlaybackException
)
{
protected
open
fun
onPlayerError
(
error
:
PlaybackException
)
{
Logger
.
i
(
TAG
,
"onPlayerError error=$error error.errorCode=${error.errorCode} connectivityLoss"
);
when
(
error
.
errorCode
)
{
when
(
error
.
errorCode
)
{
PlaybackException
.
ERROR_CODE_IO_BAD_HTTP_STATUS
->
{
PlaybackException
.
ERROR_CODE_IO_BAD_HTTP_STATUS
->
{
onDatasourceError
.
emit
(
error
);
onDatasourceError
.
emit
(
error
);
...
@@ -536,9 +550,9 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
...
@@ -536,9 +550,9 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
//PlaybackException.ERROR_CODE_IO_NO_PERMISSION,
//PlaybackException.ERROR_CODE_IO_NO_PERMISSION,
//PlaybackException.ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE,
//PlaybackException.ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE,
PlaybackException
.
ERROR_CODE_IO_UNSPECIFIED
->
{
PlaybackException
.
ERROR_CODE_IO_UNSPECIFIED
->
{
Logger
.
i
(
TAG
,
"IO error, set _shouldPlaybackRestartOnConnectivity=true"
);
_shouldPlaybackRestartOnConnectivity
=
true
;
_shouldPlaybackRestartOnConnectivity
=
true
;
_connectivityLossTime_ms
=
System
.
currentTimeMillis
()
_connectivityLossTime_ms
=
System
.
currentTimeMillis
()
Logger
.
i
(
TAG
,
"IO error, set _shouldPlaybackRestartOnConnectivity=true _connectivityLossTime_ms=$_connectivityLossTime_ms"
);
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment