Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Casanowow Life for love
VLC-Android
Commits
b6c6c1f6
Commit
b6c6c1f6
authored
Apr 18, 2018
by
Geoffrey Métais
Browse files
Video player: Restore 360° navigation
parent
73d218f9
Changes
2
Hide whitespace changes
Inline
Side-by-side
vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
View file @
b6c6c1f6
...
...
@@ -249,7 +249,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
private
boolean
mLockBackButton
=
false
;
boolean
mWasPaused
=
false
;
private
long
mSavedTime
=
-
1
;
private
float
mSavedRate
=
1
.
f
;
/**
* For uninterrupted switching between audio and video mode
...
...
@@ -311,8 +310,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
private
OnLayoutChangeListener
mOnLayoutChangeListener
;
private
AlertDialog
mAlertDialog
;
private
final
DisplayMetrics
mScreen
=
new
DisplayMetrics
();
protected
boolean
mIsBenchmark
=
false
;
@Override
...
...
@@ -735,7 +732,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if
(
mPlaybackStarted
||
mService
==
null
)
return
;
mSavedRate
=
1.0f
;
mSavedTime
=
-
1
;
mPlaybackStarted
=
true
;
...
...
@@ -846,14 +842,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mSavedTime
=
getTime
();
long
length
=
mService
.
getLength
();
//remove saved position if in the last 5 seconds
if
(
length
-
mSavedTime
<
5000
)
mSavedTime
=
0
;
else
mSavedTime
-=
2000
;
// go back 2 seconds, to compensate loading time
if
(
length
-
mSavedTime
<
5000
)
mSavedTime
=
0
;
else
mSavedTime
-=
2000
;
// go back 2 seconds, to compensate loading time
}
mSavedRate
=
mService
.
getRate
();
mService
.
setRate
(
1.0f
,
false
);
mService
.
stop
();
}
...
...
@@ -1094,20 +1086,16 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if
(
mIsNavMenu
)
return
navigateDvdMenu
(
keyCode
);
else
if
(!
mShowing
)
{
if
(
mFov
==
0
f
)
seekDelta
(-
10000
);
else
mService
.
updateViewpoint
(-
5
f
,
0
f
,
0
f
,
0
f
,
false
);
if
(
mFov
==
0
f
)
seekDelta
(-
10000
);
else
mService
.
updateViewpoint
(-
5
f
,
0
f
,
0
f
,
0
f
,
false
);
return
true
;
}
case
KeyEvent
.
KEYCODE_DPAD_RIGHT
:
if
(
mIsNavMenu
)
return
navigateDvdMenu
(
keyCode
);
else
if
(!
mShowing
)
{
if
(
mFov
==
0
f
)
seekDelta
(
10000
);
else
mService
.
updateViewpoint
(
5
f
,
0
f
,
0
f
,
0
f
,
false
);
if
(
mFov
==
0
f
)
seekDelta
(
10000
);
else
mService
.
updateViewpoint
(
5
f
,
0
f
,
0
f
,
0
f
,
false
);
return
true
;
}
case
KeyEvent
.
KEYCODE_DPAD_UP
:
...
...
@@ -1117,10 +1105,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
volumeUp
();
return
true
;
}
else
if
(!
mShowing
)
{
if
(
mFov
==
0
f
)
showAdvancedOptions
();
else
mService
.
updateViewpoint
(
0
f
,
-
5
f
,
0
f
,
0
f
,
false
);
if
(
mFov
==
0
f
)
showAdvancedOptions
();
else
mService
.
updateViewpoint
(
0
f
,
-
5
f
,
0
f
,
0
f
,
false
);
return
true
;
}
case
KeyEvent
.
KEYCODE_DPAD_DOWN
:
...
...
@@ -1985,8 +1971,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
return
mService
!=
null
&&
mTouchDelegate
.
onTouchEvent
(
event
);
}
boolean
updateViewpoint
(
float
yaw
,
float
pitch
)
{
return
mService
.
updateViewpoint
(
yaw
,
pitch
,
0
,
0
,
false
);
boolean
updateViewpoint
(
float
yaw
,
float
pitch
,
float
fov
)
{
return
mService
.
updateViewpoint
(
yaw
,
pitch
,
0
,
fov
,
false
);
}
void
initAudioVolume
()
{
...
...
vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
View file @
b6c6c1f6
...
...
@@ -95,30 +95,29 @@ class VideoTouchDelegate(private val player: VideoPlayerActivity,
player
.
sendMouseEvent
(
MotionEvent
.
ACTION_DOWN
,
xTouch
,
yTouch
)
}
MotionEvent
.
ACTION_MOVE
->
{
if
(
mTouchAction
!=
TOUCH_IGNORE
)
{
// Mouse events for the core
player
.
sendMouseEvent
(
MotionEvent
.
ACTION_MOVE
,
xTouch
,
yTouch
)
if
(
player
.
fov
==
0f
)
{
// No volume/brightness action if coef < 2 or a secondary display is connected
//TODO : Volume action when a secondary display is connected
if
(
mTouchAction
!=
TOUCH_SEEK
&&
coef
>
2
&&
player
.
isOnPrimaryDisplay
)
{
if
(
Math
.
abs
(
yChanged
/
screenConfig
.
yRange
)
<
0.05
)
return
false
mTouchY
=
event
.
rawY
mTouchX
=
event
.
rawX
doVerticalTouchAction
(
yChanged
)
}
else
{
// Seek (Right or Left move)
doSeekTouch
(
Math
.
round
(
deltaY
),
if
(
rtl
)
-
xgesturesize
else
xgesturesize
,
false
)
}
}
else
{
if
(
mTouchAction
==
TOUCH_IGNORE
)
return
false
// Mouse events for the core
player
.
sendMouseEvent
(
MotionEvent
.
ACTION_MOVE
,
xTouch
,
yTouch
)
if
(
player
.
fov
==
0f
)
{
// No volume/brightness action if coef < 2 or a secondary display is connected
//TODO : Volume action when a secondary display is connected
if
(
mTouchAction
!=
TOUCH_SEEK
&&
coef
>
2
&&
player
.
isOnPrimaryDisplay
)
{
if
(
Math
.
abs
(
yChanged
/
screenConfig
.
yRange
)
<
0.05
)
return
false
mTouchY
=
event
.
rawY
mTouchX
=
event
.
rawX
m
TouchAction
=
TOUCH_MOVE
val
yaw
=
player
.
fov
*
-
xChanged
/
screenConfig
.
xRange
.
toFloat
()
val
pitch
=
player
.
fov
*
-
yChanged
/
screenConfig
.
xRange
.
toFloat
(
)
player
.
updateViewpoint
(
yaw
,
pitch
)
doVertical
TouchAction
(
yChanged
)
}
else
{
// Seek (Right or Left move
)
doSeekTouch
(
Math
.
round
(
deltaY
),
if
(
rtl
)
-
xgesturesize
else
xgesturesize
,
false
)
}
}
else
{
mTouchY
=
event
.
rawY
mTouchX
=
event
.
rawX
mTouchAction
=
TOUCH_MOVE
val
yaw
=
player
.
fov
*
-
xChanged
/
screenConfig
.
xRange
.
toFloat
()
val
pitch
=
player
.
fov
*
-
yChanged
/
screenConfig
.
xRange
.
toFloat
()
player
.
updateViewpoint
(
yaw
,
pitch
,
0f
)
}
}
MotionEvent
.
ACTION_UP
->
{
...
...
@@ -284,7 +283,7 @@ class VideoTouchDelegate(private val player: VideoPlayerActivity,
override
fun
onScale
(
detector
:
ScaleGestureDetector
):
Boolean
{
if
(
player
.
fov
!=
0f
)
{
val
diff
=
VideoPlayerActivity
.
DEFAULT_FOV
*
(
1
-
detector
.
scaleFactor
)
if
(
player
.
updateViewpoint
(
0f
,
0f
))
{
if
(
player
.
updateViewpoint
(
0f
,
0f
,
diff
))
{
player
.
fov
=
Math
.
min
(
Math
.
max
(
MIN_FOV
,
player
.
fov
+
diff
),
MAX_FOV
)
return
true
}
...
...
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