From 276d760cb51e05eca2c9fa9bd8f812a804e0de90 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 11 Jul 2017 09:16:09 +0100 Subject: [PATCH] Workaround for AVPlayerView being unavailable on 32-bit OSX --- modules/juce_video/native/juce_mac_Video.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/juce_video/native/juce_mac_Video.h b/modules/juce_video/native/juce_mac_Video.h index 42028e16d5..c6d50e76ed 100644 --- a/modules/juce_video/native/juce_mac_Video.h +++ b/modules/juce_video/native/juce_mac_Video.h @@ -34,7 +34,15 @@ struct VideoComponent::Pimpl : public BaseClass { setVisible (true); - #if JUCE_MAC + #if JUCE_MAC && JUCE_32BIT + auto view = [[NSView alloc] init]; // 32-bit builds don't have AVPlayerView, so need to use a layer + controller = [[AVPlayerLayer alloc] init]; + setView (view); + [view setNextResponder: [view superview]]; + [view setWantsLayer: YES]; + [view setLayer: controller]; + [view release]; + #elif JUCE_MAC controller = [[AVPlayerView alloc] init]; setView (controller); [controller setNextResponder: [controller superview]]; @@ -174,6 +182,8 @@ struct VideoComponent::Pimpl : public BaseClass private: #if JUCE_IOS AVPlayerViewController* controller = nil; + #elif JUCE_32BIT + AVPlayerLayer* controller = nil; #else AVPlayerView* controller = nil; #endif