@playdrop/playdrop-cli 0.12.39 → 0.12.40

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.
@@ -1,7 +1,7 @@
1
1
  {
2
- "version": "0.12.39",
2
+ "version": "0.12.40",
3
3
  "build": 1,
4
- "runtimeSdkVersion": "0.12.39",
4
+ "runtimeSdkVersion": "0.12.40",
5
5
  "runtimeSdkBuild": 1,
6
6
  "clients": {
7
7
  "all": {
@@ -100,7 +100,7 @@ export declare function resolveListingCaptureBrowserContextOptions(surface: AppS
100
100
  width: number;
101
101
  height: number;
102
102
  }): BrowserContextOptions;
103
- export declare function computeRecordedCrop(measurement: HostedGameMeasurement, rawWidth: number, rawHeight: number): CropRect;
103
+ export declare function computeRecordedCrop(measurement: HostedGameMeasurement, recorder: ListingRecorderMetadata, rawWidth: number, rawHeight: number): CropRect;
104
104
  export declare function runListingRecorder(recorderPath: string, pid: number, durationSeconds: number, rawOutputPath: string, metadataPath: string, audio: boolean, deadlineAt: number): Promise<ListingRecorderMetadata>;
105
105
  export declare function captureListing(targetArg: string | undefined, options?: CaptureListingOptions): Promise<void>;
106
106
  export {};
@@ -487,7 +487,7 @@ async function fitWindowToRequestedGameplay(page, requestedWidth, requestedHeigh
487
487
  function roundCropValue(value) {
488
488
  return Math.round(value);
489
489
  }
490
- function computeRecordedCrop(measurement, rawWidth, rawHeight) {
490
+ function computeRecordedCrop(measurement, recorder, rawWidth, rawHeight) {
491
491
  if (measurement.outerWidth <= 0 || measurement.outerHeight <= 0) {
492
492
  throw new Error('invalid_window_geometry');
493
493
  }
@@ -497,21 +497,30 @@ function computeRecordedCrop(measurement, rawWidth, rawHeight) {
497
497
  if (rawWidth <= 0 || rawHeight <= 0) {
498
498
  throw new Error('invalid_raw_dimensions');
499
499
  }
500
- const horizontalChrome = measurement.outerWidth - measurement.innerWidth;
501
- const verticalChrome = measurement.outerHeight - measurement.innerHeight;
500
+ const nativeOuterWidth = recorder.windowFramePoints.width;
501
+ const nativeOuterHeight = recorder.windowFramePoints.height;
502
+ if (nativeOuterWidth <= 0 || nativeOuterHeight <= 0) {
503
+ throw new Error('invalid_native_window_geometry');
504
+ }
505
+ const horizontalChrome = nativeOuterWidth - measurement.innerWidth;
506
+ const verticalChrome = nativeOuterHeight - measurement.innerHeight;
502
507
  if (horizontalChrome < 0 || verticalChrome < 0) {
503
508
  throw new Error('invalid_chrome_geometry');
504
509
  }
505
- const leftChrome = horizontalChrome / 2;
506
- const bottomChrome = leftChrome;
510
+ const usesSyntheticMobileWindow = Math.abs(measurement.outerWidth - measurement.innerWidth) <= 1
511
+ && Math.abs(measurement.outerHeight - measurement.innerHeight) <= 1
512
+ && (Math.abs(nativeOuterWidth - measurement.outerWidth) > 1
513
+ || Math.abs(nativeOuterHeight - measurement.outerHeight) > 1);
514
+ const leftChrome = usesSyntheticMobileWindow ? 0 : horizontalChrome / 2;
515
+ const bottomChrome = usesSyntheticMobileWindow ? 0 : leftChrome;
507
516
  const topChrome = verticalChrome - bottomChrome;
508
517
  if (topChrome < 0) {
509
518
  throw new Error('invalid_vertical_chrome_geometry');
510
519
  }
511
520
  const cropLeftCss = leftChrome + measurement.iframeRect.left;
512
521
  const cropTopCss = topChrome + measurement.iframeRect.top;
513
- const scaleX = rawWidth / measurement.outerWidth;
514
- const scaleY = rawHeight / measurement.outerHeight;
522
+ const scaleX = rawWidth / nativeOuterWidth;
523
+ const scaleY = rawHeight / nativeOuterHeight;
515
524
  const x = roundCropValue(cropLeftCss * scaleX);
516
525
  const y = roundCropValue(cropTopCss * scaleY);
517
526
  const width = roundCropValue(measurement.iframeRect.width * scaleX);
@@ -1035,7 +1044,7 @@ async function captureListing(targetArg, options = {}) {
1035
1044
  const rawVideoStream = extractVideoStream(rawProbe);
1036
1045
  const rawDurationSeconds = readDurationSeconds(rawProbe);
1037
1046
  const rawAudioTrackCount = countAudioStreams(rawProbe);
1038
- const crop = computeRecordedCrop(measurement, rawVideoStream.width, rawVideoStream.height);
1047
+ const crop = computeRecordedCrop(measurement, recorderMetadata, rawVideoStream.width, rawVideoStream.height);
1039
1048
  console.log(`[listing] Cropping raw capture to gameplay at ${crop.width}x${crop.height}+${crop.x}+${crop.y}.`);
1040
1049
  await encodeListingVideo(surfaceOutputPaths.rawVideoPath, surfaceOutputPaths.finalVideoPath, surfaceOutputPaths.posterPath, crop, dimensions.width, dimensions.height, parsedOptions.fps, parsedOptions.posterAtSeconds, captureDeadlineAt);
1041
1050
  if (exportedAudioPath) {
@@ -1,7 +1,7 @@
1
1
  {
2
- "version": "0.12.39",
2
+ "version": "0.12.40",
3
3
  "build": 1,
4
- "runtimeSdkVersion": "0.12.39",
4
+ "runtimeSdkVersion": "0.12.40",
5
5
  "runtimeSdkBuild": 1,
6
6
  "clients": {
7
7
  "all": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playdrop/playdrop-cli",
3
- "version": "0.12.39",
3
+ "version": "0.12.40",
4
4
  "description": "Official Playdrop CLI for publishing browser games, creator apps, and AI-generated game assets on playdrop.ai",
5
5
  "homepage": "https://www.playdrop.ai",
6
6
  "repository": {