Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLC Browser Plugins
Commits
ec00814f
Commit
ec00814f
authored
Feb 10, 2014
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mac plugin: add hack to support Safari 5 which is the latest version still running on OS X 10.6
parent
e3de9db2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
5 deletions
+44
-5
npapi/vlcplugin_mac.mm
npapi/vlcplugin_mac.mm
+44
-5
No files found.
npapi/vlcplugin_mac.mm
View file @
ec00814f
...
...
@@ -43,6 +43,14 @@
@end
@interface
VLCBrowserRootLayer
:
CALayer
{
NSTimer
*
_interfaceUpdateTimer
;
VlcPluginMac
*
_cppPlugin
;
}
@property
(
readwrite
)
VlcPluginMac
*
cppPlugin
;
-
(
void
)
startUIUpdateTimer
;
-
(
void
)
addVoutLayer
:(
CALayer
*
)
aLayer
;
-
(
void
)
removeVoutLayer
:(
CALayer
*
)
aLayer
;
-
(
CGSize
)
currentOutputSize
;
...
...
@@ -123,6 +131,13 @@ VlcPluginMac::VlcPluginMac(NPP instance, NPuint16_t mode) :
VlcPluginBase
(
instance
,
mode
)
{
browserRootLayer
=
[[
VLCBrowserRootLayer
alloc
]
init
];
[
browserRootLayer
setCppPlugin
:
this
];
const
char
*
userAgent
=
NPN_UserAgent
(
this
->
getBrowser
());
if
(
strstr
(
userAgent
,
"Safari"
)
&&
strstr
(
userAgent
,
"Version/5"
))
{
NSLog
(
@"Safari 5 detected, deploying UI update timer"
);
[
browserRootLayer
performSelector
:
@selector
(
startUIUpdateTimer
)
withObject
:
nil
afterDelay
:
1.
];
}
}
VlcPluginMac
::~
VlcPluginMac
()
...
...
@@ -212,10 +227,6 @@ bool VlcPluginMac::get_toolbar_visible()
void
VlcPluginMac
::
update_controls
()
{
[
controllerLayer
setMediaPosition
:
libvlc_media_player_get_position
(
getMD
())];
[
controllerLayer
setIsPlaying
:
playlist_isplaying
()];
[
controllerLayer
setIsFullscreen
:
this
->
get_fullscreen
()];
libvlc_state_t
currentstate
=
libvlc_media_player_get_state
(
getMD
());
if
(
currentstate
==
libvlc_Playing
||
currentstate
==
libvlc_Paused
||
currentstate
==
libvlc_Opening
)
{
[
noMediaLayer
setHidden
:
YES
];
...
...
@@ -226,7 +237,12 @@ void VlcPluginMac::update_controls()
[
playbackLayer
setHidden
:
YES
];
}
[
controllerLayer
setNeedsDisplay
];
if
(
controllerLayer
)
{
[
controllerLayer
setMediaPosition
:
libvlc_media_player_get_position
(
getMD
())];
[
controllerLayer
setIsPlaying
:
playlist_isplaying
()];
[
controllerLayer
setIsFullscreen
:
this
->
get_fullscreen
()];
[
controllerLayer
setNeedsDisplay
];
}
}
bool
VlcPluginMac
::
create_windows
()
...
...
@@ -382,6 +398,29 @@ bool VlcPluginMac::handle_event(void *event)
return
self
;
}
-
(
void
)
startUIUpdateTimer
{
_interfaceUpdateTimer
=
[
NSTimer
scheduledTimerWithTimeInterval
:
0.3
target
:
self
selector
:
@selector
(
_updateUI
)
userInfo
:
nil
repeats
:
YES
];
[
_interfaceUpdateTimer
retain
];
[
_interfaceUpdateTimer
fire
];
}
-
(
void
)
dealloc
{
if
(
_interfaceUpdateTimer
)
{
[
_interfaceUpdateTimer
invalidate
];
[
_interfaceUpdateTimer
release
];
}
[
super
dealloc
];
}
-
(
void
)
_updateUI
{
if
(
_cppPlugin
)
_cppPlugin
->
update_controls
();
}
-
(
void
)
addVoutLayer
:(
CALayer
*
)
aLayer
{
[
CATransaction
begin
];
...
...
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