Support for tvOS?

Hi Folks,

Is it possible to use Juce to develop apps for tvOS?

Thanks in advance,

Pete

Hi again - just a bump - any news on tvOS support in Juce? Pete

2 Likes

So… I’ve had to go ahead and create a native UI for the tvOS version of Wotja, using Swift, storyboards etc. for the front end (and with our substantial C++ engine behind the scenes - no Juce, of course). There are quite a few limitations in tvOS, mainly in regard to the way that the remote works to control the app; and the way that user focus animates. The port of our C++/Objective-C layer was really easy, as you’d expect. Shame that Juce wasn’t an option!

1 Like

Hi folks, FWIW I’ve been able to build most core Juce libraries for tvOS, using

#if TARGET_OS_TV
…
#else // TARGET_OS_TV
…
#endif // TARGET_OS_TV

Primarily: had to mess around MIDI support, and a few other changes such as no clipboard support.
I’ve not attempted any UI Controller (i.e. remote control) support!
Only took me an hour or so.

Is this something you might put in the backlog?

Best wishes,

Pete

1 Like

As a further update, I’ve even managed to the the complex animated display in Wotja tvOS working - rendered entirely from Juce (replacing my previous 100% Swift UI implementation). This is via a UIView / juce Component peer combo. NB: Didn’t require much in the way of customisation to Juce to get this to work.

On top of our custom UIView (which is hooked-up to my Juce componentry, as noted), I have some “normal” tvOS controls to manage the UI navigation and some native lists for selecting content. But, the bulk of the tvOS UI (the complex animation stuff) is now all done via Juce. Yay! :slight_smile:

So, that is great news. I’m sure we’re not the only developers who could take advantage of Juce in this way, to get great UI results on tvOS.

Best to all,

Pete

2 Likes

Hi Pete,
Are you guys considering sharing with the Juce community, some of whom could possibly help edit it and get it into the Juce core code. It appears like there has been a lot of time and possibly work between your posts. If you did this work for someone else, you could suggest that putting it in Juce core is a great way to keep it up to date with Juce.
Whether you do or not, congrats on getting it working.

Hi Lob,

Thanks for reaching out.

Sure, I’m very happy to share the code. However, I’m guessing the Juce developers are just too busy to reach out.

I tend to update Juce only very rarely, as historically there are a lot of things that need fixing, and they can be quite onerous to work through. So, for example, we stuck on Juce 5.3.0 for a very long time; and I only made the move to Juce 6 a week or so ago. It has taken me that week or so to work through most of the issues.

The general things I’ve had to patch in Juce 6 are:

  • iPad split-screen / multi-tasking support; this is the one which was most fiddly to fix. I’ve already reached-out to the Juce devs offering them my code for this (iOS Multitasking - #7 by peteatjuce)
  • tvOS support - this wasn’t actually that hard to do, and probably only took me 2-3 hours or so to do yesterday. Mainly, it was about stripping-out low-level MIDI support, tweaking related to orientation handling etc… The trickiest thing was to work-out exactly how to use createNewPeer in Wotja, in combination with a hosting custom UIView… the docs weren’t great in this area! But, I got lucky and the Juce side of the UI “just worked”, which was a great feeling! Our next update will feature a completely new animation mode for Wotja tvOS, which I think looks really nice. Thanks to the Juce team for making this possible to do!
  • changes to allow adding “X” buttons to the TabBarButton buttons for desktop (surprisingly fiddly - you can look at the free Wotja for macOS/Windows to see these)
  • default font detection in macOS, which doesn’t work properly
  • some fixes to focus handling, to allow the apps to work properly on Android TV
  • I’d had to make extensive changes to 5.3.0 for viewport scrolling to work properly in list views, but I’m happy to report that is fixed in Juce 6 :slight_smile:
  • PopUp button alignment, to make sure that pop-up menus appear on screen, especially on small Android devices - quite fiddly to fix
  • some small tweaks for WatchKit extension support
  • some fairly extensive changes to get soft keyboard appear/disappear logic working properly on both iOS and Android, and to be able to pop-up a native editor activity on iOS and/or Android when required

Other things I’ve had to work hard on outside of the Juce layer are:

  • native menu handling for iOS (phone / pad), as the Juce menus are nowhere near as nice as the native ones)
  • native alert handling for iOS and macOS (as above - but this is relatively easy)
  • creation of a cross-platform navigation framework that looks quite similar to the UINavigationController stuff in iOS. If you were to download the free version of Wotja, you could see how this looks. This has been a very significant amount of work over the past few years; without it, it wouldn’t have been feasible for us to use Juce as the cross-platform layer for Wotja (before this, the Wotja UI was native Swift / Objective-C for both iOS and macOS). I chose Juce over Qt because Juce has hugely better support for Indie developers, and of course a far superior audio interfacing layer.
  • our own Android audio device adaptor, as we had a lot of problems historically with the Juce implementation wrt breaking-up etc. I don’t actually know how well the one in Juce 6 works, and will certainly investigate Oboe at some point.

Don’t get me wrong - Juce is fabulous, and has allowed us to no longer rely on our own cross-platform rendering layer. But to allow our range of apps (iOS, Android, macOS, Windows, tvOS) to work well on all platforms, has required very significant work over the years. Anyhow, we’re able to build on all that work now, and focus much more on App features rather than the lower-level stuff.

With best wishes,

Pete

1 Like

Hi @reuk,

Just found this old post of mine.

If you want my tvOS porting mods, just reach out with a DM or mail and I can send them to you!
Or, I could create a pull request if you like. Just let me know…

Best wishes,

Pete

1 Like

Thanks for the offer. The team is very busy at the moment, and supporing tvOS is not a priority for us at the moment.

It’s understandable to not support new platforms: the bandwidth needed to port every feature, test 'em all on the different models of the device(s) (eg Apple TV 4k vs HD?), integrate them into CI, regression testing on other devices… it’s a huge undertaking. Been there, done that, for most systems.

I am curious though - got any demos @peteatjuce ?

Also, how far did you get feature-wise - are things like IAP added? Is networking the same as on iOS - no new layers of security? What happens when new windows or popup menus are brought up?

Hi @jrlanglois,

Sure, absolutely. Just happy to save the Juce team a bit of effort if they wanted it :slight_smile:

Yes - you can can download the free Wotja for iOS - it has a tvOS variant. The animations you see in the tvOS app are all Juce. The menus you interactive with are all Swift / Storyboard. The whole thing is glued together using Objective-C++, as you’d expect!

Yes, IAP works on tvOS, though you have to make the purchase on the iOS or macOS side. tvOS, iOS, macOS all share the same bundle id for any given product (hence sharing IAP).

FTAOD, the interactive UI is handled by native tvOS components. The fancy UI animated background is all Juce UI.

Hoping that helps - please feel free to ask if you have any more questions!

Pete

1 Like

Just a reminder that if this code is ever required, I can provide my changes for a simple merge :slight_smile:

Pete

4 Likes

Hi @peteatjuce,
I’m just curious: did anything happen in the meanwhile regarding JUCE support for tvOS? I’m working on a platform for educational games fully written in JUCE which I eventually want to port to tvOS. If there’s no prospect for official JUCE tvOS support, would you be willing to share a simple demo project using JUCE on tvOS, e.g. on GitHub?
Best regards,
Fritz

Hi @mnsp,

Thanks for your interest! While it made sense to me to offer up my porting changes to integrate them with JUCE, it’d be a quite a lot of effort to decouple my changes for sharing on an Ad Hoc basis. I’m still open, of course, to passing them on to the JUCE team to integrate, to share with the global JUCE community, if there was interest from them!

There are around 42 changes, spread across the following files:

modules/juce_audio_devices/juce_audio_devices.cpp
modules/juce_audio_devices/midi_io/juce_MidiDevices.h
modules/juce_audio_devices/native/juce_ios_Audio.cpp
modules/juce_audio_devices/native/juce_mac_CoreMidi.mm
modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm
modules/juce_core/native/juce_mac_Files.mm
modules/juce_core/native/juce_posix_SharedCode.h
modules/juce_core/system/juce_TargetPlatform.h
modules/juce_graphics/native/juce_mac_Fonts.mm
modules/juce_gui_basics/filebrowser/juce_FileChooser.cpp
modules/juce_gui_basics/filebrowser/juce_FileChooser.h
modules/juce_gui_basics/juce_gui_basics.cpp
modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm
modules/juce_gui_basics/native/juce_ios_Windowing.mm

Best wishes, Pete

1 Like

Hi Pete,

thank you for your quick reply! I see, it would basically be a fork of JUCE itself and maintaining it (separately from whatever other changes you’re probably already maintaining to keep your apps up to date) would be tedious.

Juce as a follow-up question: do you think it’s worthwhile publishing apps for Apple TV? I assume that you get much less downloads on that platform compared to iOS.

Best regards,
Fritz

@mnsp I should also explain that - you can see this if you get the free Wotja for your Apple TV! - Wotja for tvOS uses a native (swift) UI, but uses JUCE for rendering the visualiser graphics which are the background to the main UI. That allows me to have a UI that 100% suits the TV device in terms of controls, but where the complex background graphics are 100% cross platform (via JUCE).

Best wishes, Pete

1 Like

Hi @mnsp it works for us, as those of our users with Apple TVs really value it. Wotja is a Universal app - in that using the same Apple bundle ID, we have versions for macOS, iOS, tvOS.

IAP purchases made on iOS/tvOS are picked-up on the tvOS platform; so there is a further incentive for our users that embrace all Apple devices. Our watchOS UI is 100% Swift for what it is worth - but icons are rendered on the iOS side via JUCE/UIKit, and delivered to the tvOS layer.

Pete

1 Like

Thanks for your advice, Pete. I’ve been thinking a bit about it. My case is likely to be more complicated as I have lots of custom UI input elements (it’s a game platform, after all), and the tvOS model of gesture inputs doesn’t seem to match well with JUCE’s touch event model. Anyways, if I make some progress on this issue, I’ll post again here.