Skip to content

Conversation

JPKribs
Copy link
Member

@JPKribs JPKribs commented Apr 6, 2025

Summary

Today, I built the Main tvOS build on my actual Apple TV and I found that external trailers always failed to open. I needed to add this to info.plist:

<key>LSApplicationQueriesSchemes</key>
	<array>
		<string>youtube</string>
	</array>

This is IF we want to proceed with this. I've tested this on a real device and can confirm this now works. I wasn't even aware there was a way to build on a remote Apple TV because I never looked into it...

I think the two major reasons we wouldn't want to do this are:

  1. Not all external trailers are going to be YouTube. Do we want to add URL schema for all various sources that come up? This opens us up to the requests for "Enable Trailers for X Platform" which adds some additional maintenance.
  2. From a FOSS perspective, linking into Google's YouTube can feel a bit taboo. I don't personally see the issue but I can understand why that might less than ideal to some folks.

Let me know if we want to proceed!

Proof

ScreenRecording_04-05-2025.19-02-41_1.mov

@JPKribs JPKribs added the bug Something isn't working label Apr 6, 2025
@JPKribs JPKribs marked this pull request as draft April 6, 2025 22:05
@JPKribs JPKribs marked this pull request as ready for review April 6, 2025 22:31
@JPKribs
Copy link
Member Author

JPKribs commented Apr 6, 2025

@LePips no rush since this only impacts tvOS / Main. I've built this out more. Instead of hardcoding YouTube, I made a real DeepLinkURL Struct for this. Testing and working on a real world Apple TV. I only really tested Vimeo and YouTube.

I'm honestly up in the air whether we want to support this type of linking. Entirely your call on this. I've built this out more so adding more in the future / maintaining is easier.

@thornbill
Copy link
Member

I'm curious what happens if those apps are not installed... will the user be prompted to install them?

@JPKribs
Copy link
Member Author

JPKribs commented Apr 7, 2025

I'm curious what happens if those apps are not installed... will the user be prompted to install them?

Right now it errors with: "Unable to open trailer in ApplicationName"

I tested that with a URL to Vimeo when I uninstalled. I could make it more of a call to action or even link in the app store but then we'd have to keep those links up to date if they ever change. I don't imagine App Store URLs change all that much though?


ApplicationName being one of the below. I don't think we need all of these but these are all of the AppleTV apps I found that we could link to:

  • "YouTube"
  • "Vimeo"
  • "Apple TV"
  • "iTunes"
  • "Netflix"
  • "Disney+"
  • "Amazon Prime Video"
  • "HBO Max"
  • "Hulu"
  • "Peacock"
  • "Paramount+"
  • "Dailymotion"
  • "Twitch"
  • "IMDb"
  • "TMDb"
  • "Unknown" - This one is localized

Edit: Ugh. It's MAX now isn't it? If we want HBO / HBO Max / MAX I will need to confirm that LSApplicationQueriesSchemes is still the same. Why do they keep changing it haha

@dkanada
Copy link
Member

dkanada commented Apr 7, 2025

Whether or not we should link to external apps for trailers feels like more of a server question. Since the server currently supports it I'd say it's a net positive that iOS and tvOS include support. It would be similar to linking IMDb for a movie when the external ID exists on the server.

@JPKribs
Copy link
Member Author

JPKribs commented Apr 7, 2025

Whether or not we should link to external apps for trailers feels like more of a server question. Since the server currently supports it I'd say it's a net positive that iOS and tvOS include support. It would be similar to linking IMDb for a movie when the external ID exists on the server.

That makes complete sense! Most of my hesitance is that would make Swiftfin one of the few apps that "requires" another app downloaded to work. Web, trailers embed in the same browser window so it feels very cohesive. To add to it, I don't think I've used an Apple TV app that opens another app? I was clicking through this morning and I think Swiftfin would be the only tvOS app I've personally seen that has this type of handoff. Not that it's a problem just part of why I wanted to tread carefully when looking at this.

@dkanada
Copy link
Member

dkanada commented Apr 7, 2025

Your comments also make sense - it's exactly why I don't bother with trailers in my own case haha. For what it's worth I'm certain the Android TV client supports YouTube but I'm not sure about other services. I also believe some Apple TV+ integrations link out to external apps if you select a show only on their service but I haven't looked at those in a while.

@JPKribs JPKribs marked this pull request as draft April 12, 2025 04:11
@JPKribs JPKribs marked this pull request as ready for review April 12, 2025 05:05
@JPKribs JPKribs requested a review from LePips April 14, 2025 23:11
@JPKribs JPKribs added the tvOS Specific to only tvOS label Apr 23, 2025
@JPKribs JPKribs changed the title [tvOS] External Trailer Fix External Trailer Fix Apr 24, 2025
@LePips
Copy link
Member

LePips commented Apr 29, 2025

Just waiting to personally test on my Apple TV.

@JPKribs
Copy link
Member Author

JPKribs commented Jul 15, 2025

I just did some cleanup to fix the complexity warning. Please let me know if we'd prefer the original "complex" route instead. This new route doesn't trigger the complexity warning but I worry about the nested loop.

The goal/issue this is used for is identifying the app that the trailer URL should open. For example, parsing the URL "youtube.com/abc" and identifying this is YouTube and attaching the prefix "YouTube://" to the URL so tvOS knows to use the YouTube app. This also needs to account for youtu.be, m.youtube.com, etc. On first call, I create my map to make this easier to query. I could also manually create this map. The reason I have this create on call was to reduce complexity in maintaining/expanding this list.

This is only called once a trailer on tvOS is selected. I am completely open to alternative structures!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tvOS Specific to only tvOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants