@slidevideo/cli 0.2.1 → 0.3.0

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.
@@ -14,10 +14,9 @@ function Run-Preview {
14
14
  if ($window -eq 0) { Start-Sleep -Milliseconds 20 }
15
15
  } while ($window -eq 0 -and $clock.Elapsed.TotalMilliseconds -lt $deadline)
16
16
  if ($window -eq 0) { Fail 'POWERPOINT_WINDOW' 'Cannot identify the slideshow owned by the private preview deck.' }
17
+ [void](Wait-ShowView ($clock.Elapsed.TotalMilliseconds + 10000))
17
18
  $show.View.AcceleratorsEnabled = 0
18
- $previewWidth = [Math]::Min([int]$job.output.width, 1600)
19
- $previewHeight = [int][Math]::Round($previewWidth / $deckAspect)
20
- [SlideVideo.Native]::PlacePreview($window, $previewWidth, $previewHeight)
19
+ [void][SlideVideo.Native]::PlaceForAudience($window, [int]$job.output.width, [int]$job.output.height, $deckAspect, $false, $false)
21
20
  $first = $job.operations[0]
22
21
  if ($first.type -ne 'slide' -or $first.at_ms -ne 0) { Fail 'POWERPOINT_PROTOCOL' 'The preview schedule must initialize a slide at time zero.' }
23
22
  Apply-Operation $first
@@ -28,6 +27,9 @@ function Run-Preview {
28
27
  try { $script:geometry = [SlideVideo.Native]::PreviewContent($window, $deckAspect) }
29
28
  catch { if ($clock.Elapsed.TotalMilliseconds -gt $deadline) { Fail 'POWERPOINT_GEOMETRY' $_.Exception.Message }; Start-Sleep -Milliseconds 20 }
30
29
  } while ($null -eq $geometry)
30
+ $previewViewportWidth = [int]$job.output.width
31
+ $previewViewportHeight = [int]$job.output.height
32
+ $previewContent = [SlideVideo.Native]::OutputContent($geometry, $previewViewportWidth, $previewViewportHeight)
31
33
  $previewClock = [Diagnostics.Stopwatch]::new()
32
34
  $status = 'paused'
33
35
  $nextOperation = 1
@@ -92,8 +94,8 @@ function Run-Preview {
92
94
  }
93
95
  }
94
96
  )
95
- $state = @{ position_ms = $position; status = $status; duration_ms = $job.duration_ms; targets = @($targets); viewport = @{ width = $previewWidth; height = $previewHeight }; content = @{ x = 0; y = 0; width = $previewWidth; height = $previewHeight } }
96
- if ($action -eq 'frame') { $state.image = [SlideVideo.Native]::PreviewJpeg($window, $geometry, $previewWidth, $previewHeight) }
97
+ $state = @{ position_ms = $position; status = $status; duration_ms = $job.duration_ms; targets = @($targets); viewport = @{ width = $previewViewportWidth; height = $previewViewportHeight }; content = @{ x = $previewContent.x; y = $previewContent.y; width = $previewContent.width; height = $previewContent.height } }
98
+ if ($action -eq 'frame') { $state.image = [SlideVideo.Native]::PreviewJpeg($window, $geometry, $previewViewportWidth, $previewViewportHeight) }
97
99
  [Console]::WriteLine('SLIDEVIDEO_PREVIEW ' + (ConvertTo-Json -InputObject @{ id = $command.id; state = $state } -Depth 30 -Compress))
98
100
  [Console]::Out.Flush()
99
101
  }