@windowkit/appkit 0.30.1 → 0.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windowkit/appkit",
3
- "version": "0.30.1",
3
+ "version": "0.30.2",
4
4
  "description": "Retained-mode AppKit backend for Node.js: Core Animation (CALayer) layer trees, CoreText layout and drawing, IOSurface presentation, NSMenu, and native control bezels — the macOS half of react-x11.",
5
5
  "author": "Andrey Sidorov <andrey.sidorov@gmail.com>",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "install": "node scripts/install.js",
44
44
  "build": "node-gyp rebuild",
45
45
  "demo": "node demo/demo.js",
46
- "test": "node test/app-lifecycle.js && node test/animation.js && node test/layer-transform.js && node test/contents-gravity.js && node test/contents-center.js && node test/accessibility-display.js && node test/ignores-mouse-events.js && node test/popup-menu.js && node test/pasteboard-write.js && node test/surface-blit.js && node test/surface-faded.js && node test/image-smoothing.js && node test/surface-colorspace.js && node test/video-surface.js && node test/player.js && node test/round-rect-xy.js && node test/clip-rule.js && node test/radial-gradient.js && node test/control-bezels.js && node test/text-features.js && node test/font-from-data.js && node test/text-coverage.js && node test/text-typesetter.js && node test/text-line-height.js && node test/text-line-width.js && node test/text-justify.js && node test/text-scale.js && node test/symbols.js && node test/eventkit-permissions.js && node test/calendars.js && node test/calendar-writes.js && node test/screencolor.js && node test/notifications.js && node test/threaded.js && node test/threaded-verbs.js && node test/threaded-frames.js && node test/threaded-resize.js && node test/ending-worker.js && node test/live-resize.js && node test/window-states.js && node test/threaded-window-states.js && node test/activation-policy.js && node test/last-input.js"
46
+ "test": "node test/app-lifecycle.js && node test/animation.js && node test/layer-transform.js && node test/contents-gravity.js && node test/contents-center.js && node test/accessibility-display.js && node test/ignores-mouse-events.js && node test/popup-menu.js && node test/pasteboard-write.js && node test/surface-blit.js && node test/surface-faded.js && node test/image-smoothing.js && node test/surface-colorspace.js && node test/video-surface.js && node test/player.js && node test/player-vp9.js && node test/round-rect-xy.js && node test/clip-rule.js && node test/radial-gradient.js && node test/control-bezels.js && node test/text-features.js && node test/font-from-data.js && node test/text-coverage.js && node test/text-typesetter.js && node test/text-line-height.js && node test/text-line-width.js && node test/text-justify.js && node test/text-scale.js && node test/symbols.js && node test/eventkit-permissions.js && node test/calendars.js && node test/calendar-writes.js && node test/screencolor.js && node test/notifications.js && node test/threaded.js && node test/threaded-verbs.js && node test/threaded-frames.js && node test/threaded-resize.js && node test/ending-worker.js && node test/live-resize.js && node test/window-states.js && node test/threaded-window-states.js && node test/activation-policy.js && node test/last-input.js"
47
47
  },
48
48
  "dependencies": {
49
49
  "node-addon-api": "^8.3.0"
Binary file
package/src/player.mm CHANGED
@@ -31,6 +31,7 @@
31
31
 
32
32
  #include <napi.h>
33
33
  #import <AVFoundation/AVFoundation.h>
34
+ #import <VideoToolbox/VideoToolbox.h>
34
35
  #import <CoreMedia/CoreMedia.h>
35
36
  #import <CoreVideo/CoreVideo.h>
36
37
  #import <QuartzCore/QuartzCore.h>
@@ -259,8 +260,21 @@ static void Apply(CALPlayer* p, const PlayerSettings& s) {
259
260
  }
260
261
  }
261
262
 
263
+ // VP9 is one of VideoToolbox's supplemental decoders, which a process has to
264
+ // ask for before AVFoundation can use one. Without this a `vp09` track in an
265
+ // MP4 opens and comes ready, and reports a picture of no size and hands out
266
+ // no frames, with no error anywhere. Asked once, and of nothing on a Mac that
267
+ // has no such decoder: its VP9 then fails as any format it cannot play does.
268
+ static void RegisterSupplementalDecoders() {
269
+ static dispatch_once_t once;
270
+ dispatch_once(&once, ^{
271
+ VTRegisterSupplementalVideoDecoderIfAvailable(kCMVideoCodecType_VP9);
272
+ });
273
+ }
274
+
262
275
  static Napi::Value CreatePlayer(const Napi::CallbackInfo& info) {
263
276
  Napi::Env env = info.Env();
277
+ RegisterSupplementalDecoders();
264
278
  if (!info[0].IsString() || info[0].As<Napi::String>().Utf8Value().empty()) {
265
279
  Napi::TypeError::New(env, "createPlayer(url, options): url is a path or a URL string")
266
280
  .ThrowAsJavaScriptException();