Skip to content

hs.ui.window().video() crashes on .show() — Swift generic-metadata init failure in AVKit VideoPlayer (macOS 27 beta) #158

Description

@yosbeda

First, thank you, @cmsj, for #149 and for shipping the video element so
quickly in #157. Really appreciate it.

What's happening

Calling .video() on an hs.ui.window() and then .show()-ing the window
reliably crashes the app. Reproduced with a minimal script built directly
from this repo's own docstring example for .video():

const clip = HSVideo.fromURLs(["/path/to/any/file.mp4"]);

hs.ui.window({ x: 100, y: 100, w: 640, h: 360 })
    .video(clip)
        .frame({ w: 640, h: 360 })
    .show();

clip.play();

What's been ruled out

  • Not specific to any particular video file. Reproduced with an original
    H.264/portrait source and with a completely vanilla ffmpeg-generated test
    clip (640x480, 30fps, H.264 Main, AAC). Same crash either way.
  • Not caused by surrounding app code. Reproduced with a from-scratch script
    containing nothing but the four lines above, no shared helpers, no layout
    containers, no window styling beyond the defaults.
  • Not a threading issue. The entire crashing call stack is one unbroken
    synchronous frame chain on com.apple.main-thread, rooted in
    NSApplication sendEvent:.

Crash signature

SIGABRT via abort(), through swift::fatalError, getSuperclassMetadata,
_swift_initClassMetadataImpl, _AVKit_SwiftUI, ViewResponderFilter. init(inputs:view:), PlatformViewRepresentableFeature.modifyViewOutputs,
NSViewRepresentable._makeView, NSHostingView.viewDidMoveToWindow, and
finally NSWindow.setContentView:.

The failure is a Swift runtime generic-metadata instantiation error
(swift_getTypeByMangledName/getSuperclassMetadata) while resolving a
type needed by AVKit's VideoPlayer, which on macOS is backed by
NSViewRepresentable. It fires the moment the hosting view is attached to
the window.

Environment

A note on how this report was put together

This report, the diagnostic scripts, and the analysis above were produced
with AI assistance (Claude). I have not personally reviewed or verified the
Swift-level reasoning about why this happens (the generic-metadata /
NSViewRepresentable explanation). I can't read the Swift source myself. I
can vouch for the observable facts: the exact reproduction steps above, and
that I personally triggered the crash multiple times. Please treat the
"why" portion as a starting hypothesis from AI analysis of the crash trace,
not as something I've confirmed at the code level myself.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions