Logo Duo Media

Duo Media

Cộng đồng
Kimeur
duo-media

Video and audio playback on iPhone Duo, Apple's foldable. Use when an app plays video or audio and must keep playing through fold, unfold and rotation, when you build a tabletop player (video above the fold, the same controls below) or a book-pose player, an up next queue, Picture in Picture, Now Playing or background audio. Covers one AVPlayer owned above the layout switch (VideoPlayer, AVPlayerViewController, AVPlayerLayer), ArrangementView with .overlay and overlayArrangementZIndex for up next (measured on the simulator in every pose), when to pick .split instead, toolbarVerticalBehavior(.disabled) for a full-screen player, AVPictureInPictureController and canStartPictureInPictureAutomaticallyFromInline, the pinned Picture in Picture video that takes half the screen when folded, MPNowPlayingSession and remote commands, the .playback audio session, and what to test in Device Hub and on a device.

Tổng quan

Nhà phát hànhKimeur
Kho mãduology
Tên kỹ năngduo-media
Sao
40
Bản fork
2
Tệp đi kèm
4
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 4 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được Kimeur công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Duo Media trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/Kimeur/duology/tree/main/plugins/duology-features/skills/duo-media
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Kimeur/duology.git /tmp/duology
mkdir -p .claude/skills
cp -r /tmp/duology/plugins/duology-features/skills/duo-media .claude/skills/duo-media
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Duo Media trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Duo Media ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Duo Media với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

duo-media

People open, close and fold iPhone Duo while something plays. The video must not stop, restart or flash, and the controls must land where hands can reach them in every pose. This skill covers players, the tabletop layout, "up next", Picture in Picture, Now Playing and the audio session.

Load neighbours when the task needs them: duo-continuity (where state lives, for every kind of state), duo-postures (every pose, and the tabletop recipe with FoldRegionsLayout), duo-layout (ArrangementView in depth), duo-scenes (Split View and windows), duo-camera (capture).

"Tabletop" and "book" are Duology's words for what Apple describes as the phone seated on a table like a laptop, and partly folded like a book. Neither is an API. Labels: measured means we ran it on the iPhone Duo simulator (iOS 27.1); derived means reasoning from Apple's words or our measurements; unverified means we could not check it. Full source list: reference/sources.md.

Rules

  1. One AVPlayer per window, in a model owned above every layout switch. Views only show it.
  2. Never pause, reload or reset playback because of a fold, a resize or onDisappear.
  3. Start with the system player. Use your own controls when you want them below the fold in tabletop, and then bring back what the system player gave you.
  4. Tabletop: the video in the top region, the same controls in the bottom region. Book: the video leading, the controls trailing. No control exists only when folded.
  5. "Up next" that floats over the video: an overlay arrangement. "Up next" that must never be covered: a split.
  6. Support Picture in Picture. Expect your window to get shorter when a video is pinned on top, and shorter still when the phone is partly folded.
  7. Own the audio session and Now Playing in the model, not in views.
  8. A full-screen player turns the vertical bar off with toolbarVerticalBehavior(.disabled), as a fixed choice for that screen.
  9. Folding is not a request to play. Never start playback because the phone folded or opened.

1. One player above the layout switch

A fold resizes the window, often changes its size class, and rebuilds the views below a layout switch. A player created in one of those views starts again from zero (Tech Talk 111461, duo-continuity).

swift
import AVKit
import SwiftUI

// requires: PlaybackModel (references/player-ownership.md)

struct PlayerRoot: View {
    @State private var playback = PlaybackModel()     // the window root owns the player

    var body: some View {
        VideoPlayer(player: playback.player)           // a view of the player, nothing more
            .ignoresSafeArea()
    }
}
  • PlaybackModel holds the player, the queue, Picture in Picture and Now Playing. Its play(_:) ignores the item already playing, so a view that calls it again after a fold restarts nothing.
  • AVPlayer is main-actor isolated in the iOS 27.1 SDK (AVPlayer.h), so the model is @MainActor.
  • Measured (20 Oct 2026): a model-owned player kept playing through book, tabletop and closing, and its AVPlayerLayer view was created once. duo-continuity measured the same with VideoPlayer rebuilt on each flip.

The model, the root, what to avoid, and UIKit: references/player-ownership.md.

2. System player or your own controls

System player (AVPlayerViewController, VideoPlayer)Your controls on an AVPlayerLayer
ControlsDrawn over the videoWherever you put them, below the fold included
Picture in PictureAVPlayerViewController: built in once the audio session and background mode are set. Apple's guides don't cover VideoPlayer.AVPictureInPictureController
Now PlayingAVPlayerViewController updates it by defaultMPNowPlayingSession from your model
Captions, AirPlayIn the system controlsYours to add (AVRoutePickerView for AirPlay)
Apple's advicePrefer it (HIG: Playing video)Match the system player's behaviour if you build one

On Duo the difference is tabletop. The system player draws its controls over the video; Apple's tabletop advice wants them on the bottom half. Whether the system player moves them when the phone is partly folded is not measured yet (references/testing.md).

3. Tabletop and book

Apple names one optional layout for a single pose: the phone on a table, media in the top region, tappable controls on the stable bottom region, with the same controls and hierarchy as every other pose (Tech Talk 111466, Tech Talk 111463).

An ArrangementView with .overlay does it with no fold code. Measured on the simulator (20 Oct 2026):

PoseWindowPrimary (controls, up next)Secondary (video)overlayArrangementZIndex read in the primary
Closed466 × 678 ptFloats over the video, whole windowWhole window1
Open, flat951 × 669 ptFloats over the video, whole windowWhole window1
Book951 × 669 ptTrailing region, 455 pt wideLeading region0
Tabletop669 × 951 ptBottom region, 455 pt tallTop region0
swift
import AVKit
import SwiftUI

// requires: PlaybackModel (references/player-ownership.md)
// requires: NowPlayingPanel, VideoSurface (references/tabletop-and-up-next.md)

@available(iOS 27.1, *)
struct TabletopWatchScreen: View {
    let playback: PlaybackModel                         // owned by the window root

    var body: some View {
        ArrangementView {
            NowPlayingPanel(playback: playback)          // primary: what people touch
        } secondary: {
            VideoSurface(playback: playback)             // secondary: what people watch
                .ignoresSafeArea()
        }
        .arrangementViewStyle(.overlay)
        .background(.black)
        .toolbarVerticalBehavior(.disabled)              // fixed for this screen, never toggled
    }
}
  • The primary covers the whole window while it floats. Align its content to the bottom edge.
  • Don't put an arrangement inside a List, a ScrollView or a NavigationSplitView (overview). Present the player full screen or inside a NavigationStack.
  • Gate it with if #available(iOS 27.1, *) when the app deploys lower. Below 27.1 keep the controls over the video.
  • The other way to build it, with placement you control: FoldRegionsLayout in duo-postures, used by the gallery's tabletop player screen. Screenshots of it closed, open, in book and in tabletop: gallery README.

4. "Up next" as an overlay arrangement

Apple's layouts talk builds exactly this: a player and an "up next" view in an overlay arrangement, with a collapsed "up next" while it floats and an expanded one once the phone folds, switched by overlayArrangementZIndex (Tech Talk 111463).

swift
import SwiftUI

// requires: PlaybackModel (references/player-ownership.md), UpNextList (references/tabletop-and-up-next.md)

/// Pass this as the arrangement's primary. The view you pass in reads default
/// arrangement values, so read them one view down (duo-layout).
@available(iOS 27.1, *)
struct UpNextPrimary: View {
    let playback: PlaybackModel

    var body: some View {
        ZStack { UpNextPanel(playback: playback) }
    }
}

@available(iOS 27.1, *)
struct UpNextPanel: View {
    let playback: PlaybackModel
    @Environment(\.overlayArrangementZIndex) private var zIndex

    var body: some View {
        // Measured: 1 while floating over the video, 0 once side by side or stacked.
        UpNextList(playback: playback, limit: zIndex > 0 ? 1 : 6)
            .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomLeading)
    }
}
  • Same queue in every pose; only how much of it shows changes.
  • Closing from tabletop, the z-index went 1, 0, 1 within 0.06 s (measured). Treat it as state; don't run work on every change.
  • Choose by the relationship (talk 111463): overlay when the video is the background and the queue may cover part of it; split when the queue or a transcript is detail that must never be covered. For an audio app the talk picks split.

The full panel with transport controls, the video surface and UIKit: references/tabletop-and-up-next.md.

5. Picture in Picture

On Duo people can pin a Picture in Picture video to the top of the screen. The app below resizes to the space left, and when the phone is partly folded the pinned video grows to half the screen (Tech Talk 111466).

  • Your layout must work in a short, wide window. In tabletop with a pinned video, your app has roughly the bottom half (derived).
  • For your own video, set canStartPictureInPictureAutomaticallyFromInline when it is the main thing on screen, so it floats when people leave the app.
  • A fold doesn't send the app to the background (scenePhase stayed active, duo-scenes), so a fold shouldn't start Picture in Picture (derived).
  • Both need the playback audio category and the "Audio, AirPlay, and Picture in Picture" background mode (Configuring your app for media playback).
  • Measured: isPictureInPictureSupported() returned false on the iPhone Duo simulator. Test it on a device.

Code for a custom player, and what the restore callback needs: references/pip-and-audio.md.

6. Now Playing and the audio session

  • Category .playback, mode .moviePlayback for video. Set it before playback; an AVPlayer activates the session itself when it starts (AVPlayer.h).
  • AVPlayerViewController keeps Now Playing up to date by default. With your own controls, use MPNowPlayingSession(players:) with automaticallyPublishesNowPlayingInfo (iOS 16), from the model.
  • After an interruption, resume only when the system recommends it. iOS 27.0 deprecates interruptionNotification; read resumptionRecommendationNotification instead (AVAudioSessionTypes.h). Pause when headphones come out (HIG: Playing audio).
  • A fold is neither an interruption nor a route change. Nothing in the audio setup reacts to it.
  • No scene accessory is meant for video on the outer display. The SDK has two: the camera capture accessory, for capture, and the external non-interactive accessory, which Apple documents for connected and AirPlay displays (duo-scenes). Use AirPlay for a second screen.

Details: references/pip-and-audio.md.

7. Split View and the closed phone

  • Every app takes part in 50/50 Split View on the inner display (Tech Talk 111464). Your player may get half the display: keep the controls usable at that width.
  • Closed, the player gets the compact outer display. Keep the same controls; the overlay arrangement floats them over the video.
  • The outer front camera always occludes a corner of the outer display (overview). Let the video run under it; keep controls clear of it.

UIKit

Keep one AVPlayerViewController in a container that never goes away (duo-continuity). For tabletop, UIArrangementViewController with UIOverlayArrangement: panel in .primary, video in .secondary, and state(for: .primary)?.zIndex to switch the panel. Details: references/tabletop-and-up-next.md.

Test it

  1. In Device Hub, start playback, then press Closed, Open and Partially Open, and Rotate Right for tabletop. duo-pose from duo-pose-matrix presses them for you if the user has given Accessibility permission.
  2. After each pose: the time keeps counting, the video doesn't flash, the controls sit where the table in section 3 says, nothing interactive sits in the fold.
  3. Split View on each side, with Reduce Motion on, with VoiceOver reading each control.
  4. On a device: Picture in Picture (inline start, pinned, folded to half the screen), Now Playing on the Lock Screen and in Control Center, headphones out, a call coming in.

What we measured, how, and a device checklist: references/testing.md.

Checklist

  • One AVPlayer per window, created in a model the window root owns.
  • No pause, reload or seek in onDisappear, onAppear, a size-class change or a fold.
  • Playing state comes from the player (timeControlStatus), not a flag in a view.
  • Tabletop puts the video on top and every control below; book puts the video leading and the controls trailing.
  • No control exists only in one pose.
  • "Up next" reads overlayArrangementZIndex one view down, or uses a split when it must never be covered.
  • No arrangement inside a List, ScrollView or NavigationSplitView; iOS 27.1 APIs gated when the app deploys lower.
  • A full-screen player sets toolbarVerticalBehavior(.disabled) once, not from view state.
  • Picture in Picture works for the player you use, starts automatically from inline when the video is the main content, and the app copes with a shorter window.
  • Audio category .playback, the background mode set, Now Playing published from the model.
  • Playback never starts because the phone folded or opened.
  • Checked in Device Hub in every pose and in Split View; Picture in Picture and Now Playing checked on a device.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Duo Media làm được gì?

Video and audio playback on iPhone Duo, Apple's foldable. Use when an app plays video or audio and must keep playing through fold, unfold and rotation, when you build a tabletop player (video above the fold, the same controls below) or a book-pose player, an up next queue, Picture in Picture, Now Playing or background audio. Covers one AVPlayer owned above the layout switch (VideoPlayer, AVPlayerViewController, AVPlayerLayer), ArrangementView with .overlay and overlayArrangementZIndex for up next (measured on the simulator in every pose), when to pick .split instead, toolbarVerticalBehavior...

Vì sao nên dùng Duo Media trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Duo Media là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Duo Media trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/Kimeur/duology/tree/main/plugins/duology-features/skills/duo-media. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Duo Media?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Duo Media với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Duo Media với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Duo Media có miễn phí không?

Có. Kỹ năng này được Kimeur phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇