Skip to content

feat: add play video AppleScript command#167

Open
enkinvsh wants to merge 1 commit intosozercan:mainfrom
enkinvsh:feat/play-video-applescript
Open

feat: add play video AppleScript command#167
enkinvsh wants to merge 1 commit intosozercan:mainfrom
enkinvsh:feat/play-video-applescript

Conversation

@enkinvsh
Copy link
Copy Markdown

@enkinvsh enkinvsh commented Apr 3, 2026

Summary

Adds a play video AppleScript command that plays a specific YouTube video by its video ID. This enables programmatic playback control from automation tools, scripts, and bots.

Usage

tell application "Kaset" to play video "dQw4w9WgXcQ"

Why

Kaset's existing AppleScript dictionary covers transport controls (play/pause/next/prev, volume, shuffle, etc.) and player info queries, but there's no way to start playing a specific song programmatically. The URL scheme (kaset://play?v=VIDEO_ID) works from GUI contexts but not from LaunchAgents, daemons, or SSH sessions — which is where most automation runs.

This command fills that gap by adding a direct AppleScript interface to PlayerService.play(videoId:).

Changes

  • Kaset.sdef: Added play video command definition with a text direct parameter for the video ID
  • ScriptCommands.swift: Added PlayVideoCommand class following the exact same pattern as PlayCommand, SetVolumeCommand, and other existing commands

Use case

I'm building a Telegram bot that controls YouTube Music via Kaset on a Mac Mini server. Transport controls (play/pause/next/prev) work perfectly via AppleScript, but playing a specific song requires this command since the URL scheme doesn't work from background processes (LaunchAgent).

Add 'play video' AppleScript command that plays a specific YouTube
video by its video ID via playWithRadio, which properly sets up the
queue and avoids WebQueueSync conflicts.

Adds markUserInteracted() to PlayerService to bypass the first-time
interaction gate (mini player popup) when commands come from
AppleScript automation.

Usage: tell application "Kaset" to play video "dQw4w9WgXcQ"

The command creates a Song, marks the session as user-interacted, and
delegates to playWithRadio(song:) which handles queue setup, WebView
navigation, and radio queue fetching.
@enkinvsh enkinvsh force-pushed the feat/play-video-applescript branch from 1f7908f to 98284ed Compare April 4, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant