Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-iOS
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Alex Kusha
VLC-iOS
Commits
f7e18697
Commit
f7e18697
authored
6 years ago
by
Soomin Lee
Browse files
Options
Downloads
Patches
Plain Diff
VLCPlaybackController: Fix FillToScreen (closes #209)
(cherry picked from commit
86162757
)
parent
fd2a2620
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sources/VLCPlaybackController.m
+37
-7
37 additions, 7 deletions
Sources/VLCPlaybackController.m
with
37 additions
and
7 deletions
Sources/VLCPlaybackController.m
+
37
−
7
View file @
f7e18697
...
...
@@ -54,6 +54,7 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
NSTimer
*
_sleepTimer
;
NSUInteger
_currentAspectRatio
;
BOOL
_isInFillToScreen
;
UIView
*
_videoOutputViewWrapper
;
UIView
*
_actualVideoOutputView
;
...
...
@@ -867,20 +868,44 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
[
_mediaPlayer
jumpBackward
:
interval
];
}
-
(
NSString
*
)
screenAspectRatio
-
(
UIScreen
*
)
currentScreen
{
UIScreen
*
screen
=
[[
UIDevice
currentDevice
]
VLCHasExternalDisplay
]
?
[
UIScreen
screens
][
1
]
:
[
UIScreen
mainScreen
];
return
[
NSString
stringWithFormat
:
@"%d:%d"
,
(
int
)
screen
.
bounds
.
size
.
width
,
(
int
)
screen
.
bounds
.
size
.
height
];
return
[[
UIDevice
currentDevice
]
VLCHasExternalDisplay
]
?
[
UIScreen
screens
][
1
]
:
[
UIScreen
mainScreen
];
}
-
(
void
)
switchToFillToScreen
{
UIScreen
*
screen
=
[
self
currentScreen
];
CGSize
screenSize
=
screen
.
bounds
.
size
;
CGSize
videoSize
=
_mediaPlayer
.
videoSize
;
CGFloat
ar
=
videoSize
.
width
/
(
float
)
videoSize
.
height
;
CGFloat
dar
=
screenSize
.
width
/
(
float
)
screenSize
.
height
;
CGFloat
scale
;
if
(
dar
>=
ar
)
{
scale
=
screenSize
.
width
/
(
float
)
videoSize
.
width
;
}
else
{
scale
=
screenSize
.
height
/
(
float
)
videoSize
.
height
;
}
// Multiplied by screen.scale in consideration of pt to px
_mediaPlayer
.
scaleFactor
=
scale
*
screen
.
scale
;
_isInFillToScreen
=
YES
;
}
-
(
void
)
switchIPhoneXFullScreen
{
BOOL
inFullScreen
=
_mediaPlayer
.
videoCropGeometry
&&
[[
NSString
stringWithUTF8String
:
_mediaPlayer
.
videoCropGeometry
]
isEqualToString
:[
self
screenAspectRatio
]];
if
(
inFullScreen
)
{
if
(
_isInFillToScreen
)
{
const
char
*
previousAspectRatio
=
_currentAspectRatio
==
VLCAspectRatioDefault
?
NULL
:
[[
self
stringForAspectRatio
:
_currentAspectRatio
]
UTF8String
];
_mediaPlayer
.
videoAspectRatio
=
(
char
*
)
previousAspectRatio
;
_mediaPlayer
.
scaleFactor
=
0
;
_isInFillToScreen
=
NO
;
}
else
{
[
self
switchToFillToScreen
];
}
_mediaPlayer
.
videoCropGeometry
=
inFullScreen
?
NULL
:
(
char
*
)[[
self
screenAspectRatio
]
UTF8String
];
}
-
(
void
)
switchAspectRatio
...
...
@@ -888,15 +913,20 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
_currentAspectRatio
=
_currentAspectRatio
==
VLCAspectRatioSixteenToTen
?
VLCAspectRatioDefault
:
_currentAspectRatio
+
1
;
switch
(
_currentAspectRatio
)
{
case
VLCAspectRatioDefault
:
_mediaPlayer
.
scaleFactor
=
0
;
_mediaPlayer
.
videoAspectRatio
=
NULL
;
_mediaPlayer
.
videoCropGeometry
=
NULL
;
break
;
case
VLCAspectRatioFillToScreen
:
_mediaPlayer
.
videoCropGeometry
=
(
char
*
)[[
self
screenAspectRatio
]
UTF8String
];
// Reset aspect ratio only with aspectRatio button since we want to keep
// the user ratio with double tap.
_mediaPlayer
.
videoAspectRatio
=
NULL
;
[
self
switchToFillToScreen
];
break
;
case
VLCAspectRatioFourToThree
:
case
VLCAspectRatioSixteenToTen
:
case
VLCAspectRatioSixteenToNine
:
_mediaPlayer
.
scaleFactor
=
0
;
_mediaPlayer
.
videoCropGeometry
=
NULL
;
_mediaPlayer
.
videoAspectRatio
=
(
char
*
)[[
self
stringForAspectRatio
:
_currentAspectRatio
]
UTF8String
];
}
...
...
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