◉RORK LABJP
●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SONNET 4.5 — Retires on the Claude API on 11/30, 26 days left. If your app calls it, check the migration target●SDK 58 — Moves to React Native 0.88. R8 is now on by default in Android release builds, and iOS prebuild generates a SceneDelegate●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SONNET 4.5 — Retires on the Claude API on 11/30, 26 days left. If your app calls it, check the migration target●SDK 58 — Moves to React Native 0.88. R8 is now on by default in Android release builds, and iOS prebuild generates a SceneDelegate●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…
Articles/App Dev
◇ App Dev/2026-06-18Advanced

Building an Ambient Display App for Apple TV with Rork Max

Use the native Swift that Rork Max generates as a foundation for an Apple TV app that quietly plays on a loop. We cover Top Shelf, the focus engine, and seamless video loops, with the practical lessons that only surface in real operation.

Rork Max235tvOSApple TVSwift48AVPlayer

✦ Premium Article

The thought came to me one evening: what if the artwork from my own wallpaper app simply played on the living-room TV? I had been running iPhone wallpaper apps as an indie developer for a few years, and I suddenly wanted to see them on a large screen. Apple TV tends to fall outside the usual no-code or cross-platform conversation, but once Rork Max started generating native Swift, it finally became a realistic option.

tvOS works quite differently from iPhone. There is no touch; instead of a finger, you operate through a concept called focus. It is also assumed to stay on for long stretches, so power draw and burn-in deserve attention. Here I will use a quiet "ambient display app" that just keeps playing video as a vehicle for walking through how to refine the Swift that Rork Max generates.

Why build Apple TV with Rork Max

Standard Rork builds cross-platform with React Native (Expo), but the heart of tvOS — the focus engine, Top Shelf, and low-level AVPlayer control — does not come naturally without native Swift. Rork Max generates native Swift for iPhone, iPad, Apple Watch, Apple TV, and Vision Pro, so when you are targeting Apple TV, this is the foundation.

My own rule of thumb is simple. When I want to ship iOS and Android together quickly, I use the React Native version; when I want to reach into Apple hardware or OS integration, I use Rork Max. Apple TV is a textbook case of the latter, because the cross-platform advantage simply does not exist here.

AspectReact Native RorkRork Max (native Swift)
tvOS supportEffectively unsupportedOfficially supported
Focus engineThin abstraction, awkwardNative in SwiftUI
Top Shelf extensionDifficultImplementable as an App Extension
Low-level video controlLimitedDirect AVFoundation access

If you ask Rork Max to "make an ambient app for Apple TV that plays video full-screen on a loop," it returns a SwiftUI scaffold. As-is, though, rough edges remain: it plays, but flashes black at the seam, or focus moves in ways you did not intend. Everything from here is the hand-work.

Building a seamless video loop

The first thing you hit is the loop seam. A naive implementation that rewinds the same clip with AVPlayer and seek(to: .zero) inserts a faint black frame on every rewind. On a large TV, that instant is clearly noticeable.

The fix is the combination of AVQueuePlayer and AVPlayerLooper. Internally it prefetches the next item and stitches playback without a gap.

import AVFoundation
import SwiftUI
 
final class AmbientPlayerModel: ObservableObject {
    let player: AVQueuePlayer
    private var looper: AVPlayerLooper?
 
    init(resourceName: String) {
        guard let url = Bundle.main.url(forResource: resourceName, withExtension: "mp4") else {
            self.player = AVQueuePlayer()
            return
        }
        let item = AVPlayerItem(url: url)
        let queue = AVQueuePlayer()
        // AVPlayerLooper handles the seamless loop
        self.looper = AVPlayerLooper(player: queue, templateItem: item)
        self.player = queue
        queue.isMuted = true
        queue.actionAtItemEnd = .advance
    }
 
    func start() { player.play() }
    func stop() { player.pause() }
}

The key is to keep AVPlayerLooper retained as a property. Make it a local variable and it gets released, and the loop stops. Rork Max's initial output often leaves this as a local variable, so I promote it to a property every time.

On the SwiftUI side, wrapping AVPlayerLayer thinly is easier to control than using VideoPlayer. VideoPlayer carries playback control UI that just gets in the way for an ambient use case.

struct PlayerLayerView: UIViewRepresentable {
    let player: AVQueuePlayer
 
    func makeUIView(context: Context) -> PlayerUIView {
        let view = PlayerUIView()
        view.playerLayer.player = player
        view.playerLayer.videoGravity = .resizeAspectFill
        return view
    }
    func updateUIView(_ uiView: PlayerUIView, context: Context) {}
}
 
final class PlayerUIView: UIView {
    override class var layerClass: AnyClass { AVPlayerLayer.self }
    var playerLayer: AVPlayerLayer { layer as! AVPlayerLayer }
}

Setting videoGravity to .resizeAspectFill fills the TV's aspect ratio without margins. My wallpaper assets have all sorts of aspect ratios, so switching this to .resizeAspect produced black bars on the sides and broke the ambient immersion.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Concrete code for seamless video loops using AVQueuePlayer and AVPlayerLooper
✦A Top Shelf extension that puts your work on the top row, starting the experience before launch
✦Practical criteria for balancing the tvOS focus engine with power use and always-on display
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⬡ Dev Tools2026-04-05
Rork Max × WidgetKit & Live Activities in Practice — From Home Screen to Dynamic Island
A complete guide to implementing iOS Widgets, Lock Screen widgets, and Dynamic Island Live Activities with Rork Max. Covers WidgetKit fundamentals, Timeline update strategies, App Intents integration, and monetization.
◇ App Dev2026-10-31
When EAS Build Stops at "Project archive is too big", Count What Gets Uploaded, Largest First
EAS Build warns at 150 MiB and fails at 2 GiB. Here is how to list what will be uploaded before you send it, find the culprit, and decide what goes into .easignore.
◇ App Dev2026-10-29
An Image Requested Once Before Its Upload Stayed a 404 at the Edge. I Split the Retention Rules by Status Code and Made Upload and Purge a Single Step
A new wallpaper stayed missing in some regions because the CDN kept a 404, fetched once before the upload, as long as it kept the image itself. Per-status retention, a two-request diagnosis, and pairing upload with purge, tested in Node.