Route YouTube links tapped in descriptions through in-app playback

Description links to YouTube videos, channels, playlists, and external
video URLs now open in Yattee instead of Safari. When a video is
already playing, tapping a video link surfaces the existing
QueueActionSheet (Play Now / Play Next / Add to Queue) — the sheet is
hosted both at the app root and inside ExpandedPlayerSheet so it
appears above whichever layer is on screen.
This commit is contained in:
Arkadiusz Fal
2026-04-22 19:00:43 +02:00
parent 3afd0bdf78
commit b54c32edad
5 changed files with 103 additions and 1 deletions

View File

@@ -88,7 +88,9 @@ enum DescriptionText {
// MARK: - OpenURL Action for Seeking
extension View {
/// Adds a URL handler that intercepts timestamp links and seeks the player.
/// Adds a URL handler that intercepts timestamp links (seeks the player) and
/// known content URLs YouTube/PeerTube video/channel/playlist links and external
/// video URLs so they open in-app instead of the browser.
func handleTimestampLinks(using playerService: PlayerService?) -> some View {
self.environment(\.openURL, OpenURLAction { url in
if let seconds = DescriptionText.seekSeconds(from: url) {
@@ -97,6 +99,12 @@ extension View {
}
return .handled
}
if URLRouter().route(url) != nil {
NotificationCenter.default.post(name: .openDescriptionLink, object: url)
return .handled
}
return .systemAction
})
}