شعار Recipe Media Player

Recipe Media Player

المجتمع
Kimeur
recipe-media-player

Creates a complete SwiftUI video and podcast player for iPhone Duo, Apple's foldable: a library list-detail, a full-screen player whose playback survives every fold, unfold and rotation, a tabletop layout (video above the fold, the same controls below), a book layout (video leading, controls trailing), Picture in Picture, an up next card, a mini player and background audio. Use when someone wants to start a new video, podcast, course or streaming app from scratch, or runs /duo-new recipe-media-player. For an existing player, use duo-postures (tabletop media) and duo-continuity instead. Covers one AVPlayer, AVPlayerLayer and AVPictureInPictureController owned above the layout switch, FoldRegionsLayout reading the .division reserved region, NavigationSplitView selection kept in a model, an up next card inside the controls so it never sits in the fold, a Foundation-only model tested on the Mac, bundled sample clips made with ffmpeg, and UI tests that work on the iPhone Duo simulator.

نظرة عامة

الناشرKimeur
المستودعduology
اسم المهارةrecipe-media-player
النجوم
40
التفريعات
2
الملفات المرفقة
46
الترخيصMIT
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 46

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها Kimeur على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Recipe Media Player في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/Kimeur/duology/tree/main/plugins/duology-recipes/skills/recipe-media-player
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

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-recipes/skills/recipe-media-player .claude/skills/recipe-media-player
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Recipe Media Player في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Recipe Media Player تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Recipe Media Player بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

recipe-media-player

This recipe makes a new Xcode project: a video podcast app for iPhone Duo. The library lists shows and episodes. An episode plays full screen. Close the phone, open it, fold it like a book or set it on a table half folded, and the video keeps playing from the same frame. Near the end of an episode, an "up next" card offers the next one.

The shows are sample content. The value is the frame around them: one player that no layout change can restart, one set of controls that moves to the right place in every pose, rules you can test on the Mac in seconds, and UI tests that pass on the Duo simulator.

Labels: measured means we ran it on the iPhone Duo simulator (iOS 27.1, 20 October 2026). Unverified means we could not check it. Everything else links to Apple. "Book" and "tabletop" are Duology's words for Apple's "partially folded, like a book" and "seated on a table like a laptop"; no API reports them. Full source list: reference/sources.md.

Use a different skill when:

  • the app already exists: use duo-postures (its tabletop media recipe) and duo-continuity (playback through a fold);
  • the app is a reader with pages: use recipe-reader.

1. Create the project

/duo-new recipe-media-player runs steps 1 to 5. Run every step yourself when there is no command.

  1. Get three values from the user, or propose them:

    • AppName: letters and digits, starting with a letter (it becomes a Swift type, <AppName>App). Not Tools, and not an Apple module name such as SwiftUI or AVFoundation;
    • a bundle id such as com.example.fieldcast;
    • a new, empty folder.
  2. Run the script from this skill's folder (in the plugin: ${CLAUDE_PLUGIN_ROOT}/skills/recipe-media-player/scripts/new-project.sh):

    bash
    "${CLAUDE_PLUGIN_ROOT}/skills/recipe-media-player/scripts/new-project.sh" \
      FieldCast com.example.fieldcast ~/Developer/FieldCast

    It copies template/, replaces __APP_NAME__ and __BUNDLE_ID__ in file contents and paths (the video clips are left alone), checks none are left, and prints the next steps. It refuses a folder that exists and is not empty (exit 73), and bad or clashing names (exit 65), before it creates anything.

  3. Test the rules on the Mac. Expect 0 failed:

    bash
    cd ~/Developer/FieldCast && Tools/run-model-tests.sh
  4. Build for the Duo simulator (find its UDID with xcrun simctl list devices available | grep "iPhone Duo"):

    bash
    DEVELOPER_DIR=/Applications/Xcode-27.1.app/Contents/Developer \
    xcodebuild -project FieldCast.xcodeproj -scheme FieldCast \
      -destination "platform=iOS Simulator,id=<UDID>" \
      -derivedDataPath build/DerivedData build
  5. Install, launch straight into the player, and screenshot the display in use. Use the UDID, not booted.

    bash
    DEV=/Applications/Xcode-27.1.app/Contents/Developer
    DEVELOPER_DIR=$DEV xcrun simctl install <UDID> build/DerivedData/Build/Products/Debug-iphonesimulator/FieldCast.app
    DEVELOPER_DIR=$DEV xcrun simctl launch --terminate-running-process <UDID> com.example.fieldcast -play small-repairs-1 -paused -start 4
    DEVELOPER_DIR=$DEV xcrun simctl io <UDID> screenshot --display=primary build/outer.png     # closed
    DEVELOPER_DIR=$DEV xcrun simctl io <UDID> screenshot --display=primary-1 build/inner.png   # open

    Only the display in use has content. Look at the PNG before you report.

  6. Run the UI tests: DESTINATION="id=<UDID>" Tools/run-ui-tests.sh. A UI test brings the app to the front; tell the user first if they share the simulator.

  7. Tell the user what passed, and that poses change only in Device Hub (the checklist below).

Set DEVELOPER_DIR for every xcrun and xcodebuild call when the Mac has more than one Xcode. Never run xcode-select.

2. What you get

PathWhat it holds
<App>/Model/Catalogue, queue, up next policy, resume points, fold geometry, player regions, time text. Foundation and CoreGraphics only, every type nonisolated and Sendable.
<App>/Player/PlayerModel.swift@Observable owner of the one AVPlayer, its AVPlayerLayer and the Picture in Picture controller. Time observer, end of episode, background audio, saving.
<App>/Player/PlayerScreen.swift, PlayerControls.swiftThe player: FoldRegionsLayout with the video first and the controls second; the up next card inside the controls.
<App>/Player/VideoSurface.swiftA UIViewRepresentable that shows the model's layer and never makes its own; the AirPlay button.
<App>/Library/NavigationSplitView of shows and episodes, the episode detail, the mini player, drawn artwork.
<App>/Shared/FoldRegionsLayout, onFoldChange, test markers.
<App>/Media/Catalog.json and six 12-second clips, 640 × 360, about 110 KB each.
<App>/Info.plistOnly UIBackgroundModes = audio; Xcode generates the rest.
<App>UITests/Twelve UI tests, pose-agnostic.
Tools/run-model-tests.sh, ModelTests/main.swift, run-ui-tests.sh.

Project settings: iOS 26.0 deployment, Swift 6 language mode, SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor, approachable concurrency, file-system synchronized groups with one exception (Info.plist is not a resource), iPhone and iPad, a privacy manifest that declares UserDefaults (reason CA92.1) for resume points. The scheme turns off parallel testing so xcodebuild doesn't clone the simulator.

Architecture, data flow and test details: references/architecture.md. Sample clips, streams, Picture in Picture and background audio: references/media.md.

3. How it behaves in each pose

PoseLibraryPlayerUp next cardMini player
Closed (outer display)Collapsed to one stack; side barsControls float at the bottom; the video moves up into the space above themInside the controls, button on its own rowFull width, bottom
Open, flat, held wideSidebar and detailControls float over the video, bottom centreInside the controlsTrailing side of the fold line
BookThe system evens the columns out at the foldVideo in the leading region, controls in the trailing regionTrailing, with the controlsTrailing region
TabletopDetail, sidebar behind its buttonVideo above the fold, the same controls below itBelow the foldFull width, bottom region

Measured for the player and the library in every row, with Device Hub's pose buttons pressed by duo-pose, and with one app process kept through closed, open, book, tabletop and closed again.

4. Where each Duo technique lives

TechniqueWhereWhy
Playback survives every foldPlayerModel is @State in RootView; the player screen is a fullScreenCover attached thereState below a layout switch is rebuilt; state above it isn't (duo-continuity). RootView never changes identity.
The video layer is never rebuiltPlayerModel.playerLayer; VideoSurface only hosts itA new layer would flash black. The surfaces test marker counts views made: measured 1 through a full pose sweep.
One layout for every poseFoldRegionsLayout in PlayerScreen, geometry in Model/FoldRegions.swiftOne Layout type, so both children keep their identity (Layout). An if on the fold would rebuild them.
Reading the foldonFoldChange on the layout itself; FoldGeometry(candidates:in:)reservedRegions(kind:options:layoutDirectionBehavior:) with .division and .includeInactive, read in onGeometryChange because the first layout pass has no regions. There is no posture API (api-index).
Tabletop: watch above, touch belowFoldRegions.splitApple's one optional per-pose layout: media in the top half, the same controls in the bottom half (talk 111466).
Nothing interactive in the foldThe up next card lives inside PlayerControlsIt moves with the controls, so it is never on the fold's 40 pt frame.
The mini player avoids the foldFoldRegions.floatingBarSpanA bar across the open phone would put its buttons on the fold line. It reads the fold even while flat, so folding doesn't move it.
Library keeps its selectionLibraryModel.selection, one NavigationSplitViewThe split view collapses closed and evens out at the fold on its own (NavigationSplitView). Never swap it for a stack by size class.
Picture in PicturePlayerModel creates AVPictureInPictureController from its own layerThe system pins the floating video to the top, and stretches it to half the screen when the phone is partly folded; the app below must cope with a shorter window (talk 111466).
Sound in the backgroundsceneMovedToBackground(_:), Info.plist, the playback categoryiOS pauses a video whose layer is on screen; the model takes the player off its layer in the background (media playback setup).
No autoplay on fold, no pause on foldNothing in the views starts or stops playbackFolding is not a request to play. No onAppear or onDisappear touches the player.
Screen stays on only while watchingRootViewisIdleTimerDisabled follows "playing and on screen".

5. Customise

Change the catalogue and the rules first, then the look.

  • Your shows: edit Media/Catalog.json. media is a bundled file name or an https URL (an HLS playlist works the same way). Run Tools/run-model-tests.sh: it checks every bundled file exists, IDs are unique and episodes are numbered.
  • Up next: UpNextPolicy.lead (default 10 s, never more than half an episode) and autoplay. The library's options menu has the autoplay switch.
  • Looks: PlayerControls (the glass panel), Artwork (swap for AsyncImage when you have image URLs), EpisodeDetailView.
  • Audio-only podcasts: the item has no video track; show Artwork in VideoFrame instead of the surface. Code: references/media.md.
  • Lock Screen and Control Center: publish Now Playing information and handle remote commands with the MediaPlayer framework (MPNowPlayingInfoCenter). The template doesn't yet.
  • Add a model rule: write it in Model/, keep it nonisolated and Sendable, add a check in Tools/ModelTests/main.swift and a line to its off-main-actor check.

Keep these, whatever the app:

  1. One AVPlayer, one AVPlayerLayer, one Picture in Picture controller, owned by a model above every layout switch.
  2. One FoldRegionsLayout for the player: video first, controls second. Never an if on the pose.
  3. Every control in every pose. Tabletop moves the controls; it never adds or removes one.
  4. Nothing that starts, pauses or reloads in onAppear, onDisappear or .task below the root.
  5. Interactive overlays (the up next card) inside the controls view, never floating over the video on their own.
  6. Icon buttons with a title and a 44 × 44 pt hit region (IconButton).

6. Test it

On the Mac: Tools/run-model-tests.sh builds Model/*.swift with the test program using swiftc -swift-version 6 -default-isolation MainActor, like the app target. It reads the real Catalog.json and checks each clip. The fold checks use the frames measured on the Duo simulator (book: a 40 × 669 pt fold at x 455 in 951 × 669 pt; tabletop: 669 × 40 pt at y 455). Measured: 103 checks, under 10 seconds with the build.

On the simulator: Tools/run-ui-tests.sh. The tests start from launch switches (-play, -paused, -start, -select, -upNextLead, -autoplay 0, -loop, -resetState), find elements by identifier, tap through element.coordinate(withNormalizedOffset:), and read the player through the player.state marker (item=…|playing=1|time=4|upNext=counting|pip=0|surfaces=1|presented=1|). They never depend on the pose. Tests that need time start paused or stop at the end instead of racing a 12-second clip.

Measured: 11 passed and 1 skipped on the closed Duo simulator, about 140 s of tests; testPlayerLayoutInThisPose also passed in book pose and in tabletop. Picture in Picture is not supported on the iPhone Duo simulator (isPictureInPictureSupported() returned false), so the player hides its button there and testPictureInPictureStarts skips. Check Picture in Picture on a device.

Then check each pose by hand in Device Hub, or with duo-pose-matrix (needs the user's Accessibility permission):

bash
duo-pose-matrix com.example.fieldcast \
  --case "library=-resetState -select small-repairs-2" \
  --case "player=-resetState -play small-repairs-1 -paused -start 4"

To see playback survive the poses, launch with -play night-sky-notes-1 -loop and pass --no-relaunch.

Checklist

  • Project created with scripts/new-project.sh; no __APP_NAME__ or __BUNDLE_ID__ left.
  • Tools/run-model-tests.sh prints 0 failed.
  • xcodebuild … build succeeds for the iPhone Duo simulator with no warnings from your code.
  • The app launched on the Duo simulator; you looked at the screenshot of the display in use.
  • Tools/run-ui-tests.sh passes (Picture in Picture skips on the simulator).
  • Closed and open: the controls float over the video, every control visible.
  • Book: video leading, controls trailing, nothing in the fold. Tabletop: video above the fold, the same controls below.
  • Play, then fold, unfold and rotate: the video keeps playing from the same frame, with no black flash.
  • The up next card appears near the end and never sits in the fold; Cancel stops at the end; Play Now moves on.
  • Close the player: the mini player shows and the sound goes on; it sits clear of the fold line on the open phone.
  • On a device: Picture in Picture starts from the button and on going home, pins to the top, and comes back to the player.
  • VoiceOver reads every control's title in every pose.

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Recipe Media Player؟

Creates a complete SwiftUI video and podcast player for iPhone Duo, Apple's foldable: a library list-detail, a full-screen player whose playback survives every fold, unfold and rotation, a tabletop layout (video above the fold, the same controls below), a book layout (video leading, controls trailing), Picture in Picture, an up next card, a mini player and background audio. Use when someone wants to start a new video, podcast, course or streaming app from scratch, or runs /duo-new recipe-media-player. For an existing player, use duo-postures (tabletop media) and duo-continuity instead. Cove...

لماذا تستخدم Recipe Media Player على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Recipe Media Player عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Recipe Media Player في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/Kimeur/duology/tree/main/plugins/duology-recipes/skills/recipe-media-player. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Recipe Media Player؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Recipe Media Player؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Recipe Media Player معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Recipe Media Player مجانية؟

نعم. نشرها Kimeur على GitHub بموجب ترخيص MIT. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇