@bubo-squared/gyroview 0.1.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.
Files changed (228) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE +21 -0
  3. package/README.md +216 -0
  4. package/dist/define.d.ts +3 -0
  5. package/dist/define.js +4 -0
  6. package/dist/index.d.ts +959 -0
  7. package/dist/index.js +13 -0
  8. package/dist/packages/adapters/blob/src/BlobRandomAccessSource.js +37 -0
  9. package/dist/packages/adapters/blob/src/index.js +2 -0
  10. package/dist/packages/adapters/fetch/src/HttpRangeSource.js +194 -0
  11. package/dist/packages/adapters/fetch/src/HttpResourceLocator.js +35 -0
  12. package/dist/packages/adapters/fetch/src/httpRequest.js +126 -0
  13. package/dist/packages/adapters/fetch/src/index.js +3 -0
  14. package/dist/packages/adapters/mediabunny/src/MediabunnyAudioSegments.js +133 -0
  15. package/dist/packages/adapters/mediabunny/src/MediabunnyDemuxer.js +63 -0
  16. package/dist/packages/adapters/mediabunny/src/MediabunnyVideoTrackReader.js +84 -0
  17. package/dist/packages/adapters/mediabunny/src/SegmentChannel.js +84 -0
  18. package/dist/packages/adapters/mediabunny/src/bufferSources.js +12 -0
  19. package/dist/packages/adapters/mediabunny/src/index.js +2 -0
  20. package/dist/packages/adapters/mse-audio/src/MediaSourceAudioClock.js +139 -0
  21. package/dist/packages/adapters/mse-audio/src/SourceBufferFeeder.js +174 -0
  22. package/dist/packages/adapters/mse-audio/src/events.js +26 -0
  23. package/dist/packages/adapters/mse-audio/src/index.js +2 -0
  24. package/dist/packages/adapters/mse-audio/src/mediaSourceSupport.js +82 -0
  25. package/dist/packages/adapters/three/src/ThreeFrameRenderer.js +274 -0
  26. package/dist/packages/adapters/three/src/compileAndProve.js +14 -0
  27. package/dist/packages/adapters/three/src/fullscreenPass.js +52 -0
  28. package/dist/packages/adapters/three/src/index.js +2 -0
  29. package/dist/packages/adapters/three/src/lensTextures.js +25 -0
  30. package/dist/packages/adapters/three/src/pictureMaterials.js +44 -0
  31. package/dist/packages/adapters/three/src/renderInto.js +15 -0
  32. package/dist/packages/adapters/three/src/rendererUniforms.js +157 -0
  33. package/dist/packages/adapters/three/src/samplingStrategies.js +26 -0
  34. package/dist/packages/adapters/three/src/seamMeter/SeamMeterPass.js +79 -0
  35. package/dist/packages/adapters/three/src/seamMeter/rowMeans.js +38 -0
  36. package/dist/packages/adapters/three/src/shaderPrograms.js +66 -0
  37. package/dist/packages/adapters/three/src/shaders/analysis.frag.js +4 -0
  38. package/dist/packages/adapters/three/src/shaders/equirectangularRays.js +4 -0
  39. package/dist/packages/adapters/three/src/shaders/fixedJoin.js +4 -0
  40. package/dist/packages/adapters/three/src/shaders/fullscreen.vert.js +4 -0
  41. package/dist/packages/adapters/three/src/shaders/header.js +4 -0
  42. package/dist/packages/adapters/three/src/shaders/lensModels.js +4 -0
  43. package/dist/packages/adapters/three/src/shaders/lensSampling.js +4 -0
  44. package/dist/packages/adapters/three/src/shaders/lensTextures.js +4 -0
  45. package/dist/packages/adapters/three/src/shaders/rawLenses.frag.js +4 -0
  46. package/dist/packages/adapters/three/src/shaders/rectilinearRays.js +4 -0
  47. package/dist/packages/adapters/three/src/shaders/screenAreas.js +4 -0
  48. package/dist/packages/adapters/three/src/shaders/stitch.frag.js +4 -0
  49. package/dist/packages/adapters/three/src/webglRenderer.js +37 -0
  50. package/dist/packages/adapters/webcodecs/src/WebCodecsVideoDecoderPort.js +135 -0
  51. package/dist/packages/adapters/webcodecs/src/index.js +2 -0
  52. package/dist/packages/core/src/application/gainMatching/GainMatching.js +66 -0
  53. package/dist/packages/core/src/application/gainMatching/GainMatchingFrameSink.js +62 -0
  54. package/dist/packages/core/src/application/playback/ClockWatch.js +76 -0
  55. package/dist/packages/core/src/application/playback/DecodePipeline.js +188 -0
  56. package/dist/packages/core/src/application/playback/DecodeRun.js +93 -0
  57. package/dist/packages/core/src/application/playback/FramePairQueue.js +93 -0
  58. package/dist/packages/core/src/application/playback/FramePairer.js +60 -0
  59. package/dist/packages/core/src/application/playback/PlaybackSession.js +417 -0
  60. package/dist/packages/core/src/application/playback/SeekOrder.js +36 -0
  61. package/dist/packages/core/src/application/playback/SessionLifecycle.js +42 -0
  62. package/dist/packages/core/src/application/playback/StartGate.js +55 -0
  63. package/dist/packages/core/src/application/playback/TimeUpdates.js +31 -0
  64. package/dist/packages/core/src/application/playback/WallClock.js +46 -0
  65. package/dist/packages/core/src/application/playback/keyframeTimeAt.js +15 -0
  66. package/dist/packages/core/src/application/playback/probeDecoding.js +168 -0
  67. package/dist/packages/core/src/application/recording/frameTimesOf.js +22 -0
  68. package/dist/packages/core/src/application/recording/inspectLayout.js +21 -0
  69. package/dist/packages/core/src/application/recording/inspectRecording.js +124 -0
  70. package/dist/packages/core/src/application/recording/locateOtherLensFile.js +18 -0
  71. package/dist/packages/core/src/application/recording/motionOf.js +39 -0
  72. package/dist/packages/core/src/application/recording/readRecording.js +31 -0
  73. package/dist/packages/core/src/application/recording/timeRecording.js +57 -0
  74. package/dist/packages/core/src/application/stabilization/StabilizingFrameSink.js +31 -0
  75. package/dist/packages/core/src/domain/format/boxes/BoxLayout.js +7 -0
  76. package/dist/packages/core/src/domain/format/boxes/boxConstants.js +16 -0
  77. package/dist/packages/core/src/domain/format/boxes/scanBoxes.js +59 -0
  78. package/dist/packages/core/src/domain/format/calibration/CalibrationVersion.js +13 -0
  79. package/dist/packages/core/src/domain/format/calibration/layouts/CalibrationStringLayout.js +34 -0
  80. package/dist/packages/core/src/domain/format/calibration/layouts/LegacyCalibrationLayout.js +44 -0
  81. package/dist/packages/core/src/domain/format/calibration/layouts/MeiCalibrationLayout.js +45 -0
  82. package/dist/packages/core/src/domain/format/calibration/layouts/PolynomialCalibrationLayout.js +44 -0
  83. package/dist/packages/core/src/domain/format/calibration/offsetTokens.js +65 -0
  84. package/dist/packages/core/src/domain/format/calibration/parseOffsetString.js +52 -0
  85. package/dist/packages/core/src/domain/format/calibration/selectCalibration.js +46 -0
  86. package/dist/packages/core/src/domain/format/captureOrigin.js +20 -0
  87. package/dist/packages/core/src/domain/format/constants.js +33 -0
  88. package/dist/packages/core/src/domain/format/info/infoFields.js +110 -0
  89. package/dist/packages/core/src/domain/format/info/parseInfoRecord.js +90 -0
  90. package/dist/packages/core/src/domain/format/info/readInfoRecord.js +14 -0
  91. package/dist/packages/core/src/domain/format/layout/detectLensLayout.js +122 -0
  92. package/dist/packages/core/src/domain/format/naming/RecordingFileName.js +67 -0
  93. package/dist/packages/core/src/domain/format/records/TrailerRecords.js +83 -0
  94. package/dist/packages/core/src/domain/format/records/exposure/parseExposureRecord.js +48 -0
  95. package/dist/packages/core/src/domain/format/records/gyro/FloatGyroSampleLayout.js +39 -0
  96. package/dist/packages/core/src/domain/format/records/gyro/RawGyroSampleLayout.js +55 -0
  97. package/dist/packages/core/src/domain/format/records/gyro/SampleColumns.js +82 -0
  98. package/dist/packages/core/src/domain/format/records/gyro/gyroLayouts.js +12 -0
  99. package/dist/packages/core/src/domain/format/records/gyro/parseGyroRecord.js +129 -0
  100. package/dist/packages/core/src/domain/format/trailer/RecordHeader.js +23 -0
  101. package/dist/packages/core/src/domain/format/trailer/Trailer.js +23 -0
  102. package/dist/packages/core/src/domain/format/trailer/TrailerFooter.js +27 -0
  103. package/dist/packages/core/src/domain/format/trailer/locateRecords.js +80 -0
  104. package/dist/packages/core/src/domain/format/trailer/parseRecordIndex.js +28 -0
  105. package/dist/packages/core/src/domain/format/trailer/readTrailer.js +32 -0
  106. package/dist/packages/core/src/domain/motion/exposure/ExposureRecord.js +53 -0
  107. package/dist/packages/core/src/domain/motion/gyro/GyroTrack.js +60 -0
  108. package/dist/packages/core/src/domain/motion/gyro/medianStep.js +11 -0
  109. package/dist/packages/core/src/domain/motion/gyro/repairedTimeline.js +101 -0
  110. package/dist/packages/core/src/domain/motion/imu/ImuFrame.js +112 -0
  111. package/dist/packages/core/src/domain/motion/orientation/OrientationTrack.js +146 -0
  112. package/dist/packages/core/src/domain/motion/orientation/estimateGyroBias.js +64 -0
  113. package/dist/packages/core/src/domain/motion/orientation/gravity.js +97 -0
  114. package/dist/packages/core/src/domain/motion/stabilization/Stabilizer.js +13 -0
  115. package/dist/packages/core/src/domain/motion/stabilization/stabilizers.js +86 -0
  116. package/dist/packages/core/src/domain/motion/timing/CaptureClock.js +41 -0
  117. package/dist/packages/core/src/domain/motion/timing/FrameTimes.js +92 -0
  118. package/dist/packages/core/src/domain/motion/timing/frameTimeSources.js +61 -0
  119. package/dist/packages/core/src/domain/motion/timing/resolveFrameTimes.js +68 -0
  120. package/dist/packages/core/src/domain/optics/EquidistantModel.js +39 -0
  121. package/dist/packages/core/src/domain/optics/MeiModel.js +45 -0
  122. package/dist/packages/core/src/domain/optics/PolynomialModel.js +44 -0
  123. package/dist/packages/core/src/domain/optics/gainMatch.js +62 -0
  124. package/dist/packages/core/src/domain/optics/lensGeometry.js +18 -0
  125. package/dist/packages/core/src/domain/optics/lensPose.js +35 -0
  126. package/dist/packages/core/src/domain/optics/opticsConstants.js +5 -0
  127. package/dist/packages/core/src/domain/playback/PlayerState.js +83 -0
  128. package/dist/packages/core/src/domain/stitching/LensLayout.js +21 -0
  129. package/dist/packages/core/src/domain/stitching/StitchingSetup.js +78 -0
  130. package/dist/packages/core/src/domain/stitching/seamDisparity.js +4 -0
  131. package/dist/packages/core/src/domain/stitching/seamDisparityField.js +5 -0
  132. package/dist/packages/core/src/domain/stitching/seamJoin.js +16 -0
  133. package/dist/packages/core/src/domain/stitching/seamMismatch.js +1 -0
  134. package/dist/packages/core/src/domain/stitching/seamRing.js +4 -0
  135. package/dist/packages/core/src/domain/stitching/seamStrip.js +26 -0
  136. package/dist/packages/core/src/domain/view/Framing.js +31 -0
  137. package/dist/packages/core/src/domain/view/PictureQuality.js +26 -0
  138. package/dist/packages/core/src/domain/view/ViewMode.js +9 -0
  139. package/dist/packages/core/src/domain/view/ViewState.js +48 -0
  140. package/dist/packages/core/src/domain/view/lensTilesView.js +63 -0
  141. package/dist/packages/core/src/domain/view/magnification.js +103 -0
  142. package/dist/packages/core/src/domain/view/normalView.js +29 -0
  143. package/dist/packages/core/src/domain/view/panoramaView.js +99 -0
  144. package/dist/packages/core/src/domain/view/rectilinear.js +40 -0
  145. package/dist/packages/core/src/domain/view/screenLayout.js +113 -0
  146. package/dist/packages/core/src/domain/view/viewGestures.js +98 -0
  147. package/dist/packages/core/src/domain/view/viewModes.js +14 -0
  148. package/dist/packages/core/src/index.js +59 -0
  149. package/dist/packages/core/src/ports/FramePair.js +6 -0
  150. package/dist/packages/core/src/shared/async/Deferred.js +42 -0
  151. package/dist/packages/core/src/shared/async/RunStop.js +40 -0
  152. package/dist/packages/core/src/shared/binary/ByteRange.js +38 -0
  153. package/dist/packages/core/src/shared/binary/ByteReader.js +77 -0
  154. package/dist/packages/core/src/shared/errors/GyroViewError.js +81 -0
  155. package/dist/packages/core/src/shared/errors/reportLater.js +11 -0
  156. package/dist/packages/core/src/shared/events/Outbox.js +68 -0
  157. package/dist/packages/core/src/shared/events/TypedEmitter.js +55 -0
  158. package/dist/packages/core/src/shared/keysOf.js +10 -0
  159. package/dist/packages/core/src/shared/lazy.js +11 -0
  160. package/dist/packages/core/src/shared/math/Matrix3.js +93 -0
  161. package/dist/packages/core/src/shared/math/Quaternion.js +133 -0
  162. package/dist/packages/core/src/shared/math/Vector3.js +54 -0
  163. package/dist/packages/core/src/shared/math/clamp.js +9 -0
  164. package/dist/packages/core/src/shared/protobuf/ProtobufMessage.js +157 -0
  165. package/dist/packages/core/src/shared/text/urlPath.js +31 -0
  166. package/dist/packages/core/src/shared/text/utf8.js +12 -0
  167. package/dist/packages/core/src/shared/units/angle.js +22 -0
  168. package/dist/packages/core/src/shared/units/time.js +13 -0
  169. package/dist/packages/player/src/PlayerSource.js +15 -0
  170. package/dist/packages/player/src/browserPlayer.js +18 -0
  171. package/dist/packages/player/src/choices.js +25 -0
  172. package/dist/packages/player/src/composition/Disposables.js +31 -0
  173. package/dist/packages/player/src/composition/browserPorts.js +46 -0
  174. package/dist/packages/player/src/composition/buildPipeline.js +153 -0
  175. package/dist/packages/player/src/composition/ensureDecodable.js +63 -0
  176. package/dist/packages/player/src/composition/openInputs.js +179 -0
  177. package/dist/packages/player/src/composition/openRecording.js +42 -0
  178. package/dist/packages/player/src/controls/ChoiceMenu.js +113 -0
  179. package/dist/packages/player/src/controls/PictureMenus.js +47 -0
  180. package/dist/packages/player/src/controls/SeekBar.js +125 -0
  181. package/dist/packages/player/src/controls/SoundControls.js +41 -0
  182. package/dist/packages/player/src/controls/TransportButtons.js +31 -0
  183. package/dist/packages/player/src/controls/ViewGestures.js +136 -0
  184. package/dist/packages/player/src/controls/Wording.js +78 -0
  185. package/dist/packages/player/src/controls/controlParts.js +36 -0
  186. package/dist/packages/player/src/controls/controls.js +4 -0
  187. package/dist/packages/player/src/controls/controlsBar.js +23 -0
  188. package/dist/packages/player/src/controls/controlsMarkup.js +85 -0
  189. package/dist/packages/player/src/controls/customControls.js +59 -0
  190. package/dist/packages/player/src/controls/formatTime.js +19 -0
  191. package/dist/packages/player/src/controls/icons.js +40 -0
  192. package/dist/packages/player/src/controls/keyboard.js +118 -0
  193. package/dist/packages/player/src/controls/messages.js +94 -0
  194. package/dist/packages/player/src/controls/parseMarkup.js +31 -0
  195. package/dist/packages/player/src/controls/viewButtons.js +14 -0
  196. package/dist/packages/player/src/element/ElementLoads.js +119 -0
  197. package/dist/packages/player/src/element/FullscreenToggle.js +39 -0
  198. package/dist/packages/player/src/element/GyroViewElement.js +313 -0
  199. package/dist/packages/player/src/element/IdleWatcher.js +71 -0
  200. package/dist/packages/player/src/element/TypedEventElement.js +22 -0
  201. package/dist/packages/player/src/element/accessibleRegion.js +19 -0
  202. package/dist/packages/player/src/element/attributeNames.js +51 -0
  203. package/dist/packages/player/src/element/attributes.js +101 -0
  204. package/dist/packages/player/src/element/defineGyroView.js +21 -0
  205. package/dist/packages/player/src/element/earlyProperties.js +36 -0
  206. package/dist/packages/player/src/element/elementSource.js +23 -0
  207. package/dist/packages/player/src/element/liveSettings.js +138 -0
  208. package/dist/packages/player/src/element/playbackAttributes.js +53 -0
  209. package/dist/packages/player/src/element/playerEventMirror.js +33 -0
  210. package/dist/packages/player/src/element/reflectedProperties.js +78 -0
  211. package/dist/packages/player/src/element/styles.js +4 -0
  212. package/dist/packages/player/src/element/template.js +47 -0
  213. package/dist/packages/player/src/index.js +10 -0
  214. package/dist/packages/player/src/inspectRecording.js +22 -0
  215. package/dist/packages/player/src/player/DrawingBufferFit.js +77 -0
  216. package/dist/packages/player/src/player/FrameLoop.js +40 -0
  217. package/dist/packages/player/src/player/PictureSettings.js +60 -0
  218. package/dist/packages/player/src/player/Player.js +377 -0
  219. package/dist/packages/player/src/player/PlayerEvents.js +28 -0
  220. package/dist/packages/player/src/player/PlayerPhase.js +21 -0
  221. package/dist/packages/player/src/player/PlayerSound.js +61 -0
  222. package/dist/packages/player/src/player/PlayerView.js +113 -0
  223. package/dist/packages/player/src/player/SessionRelay.js +66 -0
  224. package/dist/packages/player/src/player/ensureFinite.js +26 -0
  225. package/dist/packages/player/src/player/loadRecording.js +65 -0
  226. package/dist/packages/player/src/player/transportEvents.js +29 -0
  227. package/dist/standalone.js +4919 -0
  228. package/package.json +73 -0
@@ -0,0 +1,959 @@
1
+ /**
2
+ * A recording reachable over HTTP with Range support (see README, "Serving recordings").
3
+ */
4
+ export interface UrlInput {
5
+ readonly url: string;
6
+ }
7
+ /**
8
+ * A recording already in the browser: a `File` from a picker or a drop.
9
+ */
10
+ export interface BlobInput {
11
+ readonly blob: Blob;
12
+ readonly name: string;
13
+ }
14
+ export type MediaInput = UrlInput | BlobInput;
15
+ /**
16
+ * Everything that names what to play. The second input is the other lens's file of a
17
+ * split-file recording, found beside the main one by itself when left out.
18
+ */
19
+ export interface PlayerSource {
20
+ readonly main: MediaInput;
21
+ readonly second?: MediaInput | undefined;
22
+ }
23
+ declare const brand: unique symbol;
24
+ type Brand<Base, Name extends string> = Base & {
25
+ readonly [brand]: Name;
26
+ };
27
+ declare const space: unique symbol;
28
+ interface Size<Space extends string> {
29
+ readonly width: number;
30
+ readonly height: number;
31
+ readonly [space]?: Space;
32
+ }
33
+ declare const CalibrationVersion: {
34
+ readonly Legacy: 1;
35
+ readonly Polynomial: 2;
36
+ readonly Mei: 3;
37
+ };
38
+ type CalibrationVersion = (typeof CalibrationVersion)[keyof typeof CalibrationVersion];
39
+ type Milliseconds = Brand<number, "Milliseconds">;
40
+ type Seconds = Brand<number, "Seconds">;
41
+ type FrameTimeSourceName = "exposure-record" | "track-timestamps" | "nominal";
42
+ type LensLayoutKind = "multi-track" | "split-files" | "packed";
43
+ type FileLayoutHint = Exclude<LensLayoutKind, "packed">;
44
+ type TrackOrderHint = "stream-10-first" | "stream-00-first";
45
+ type LensDimension = Size<"video pixels">;
46
+ interface SensorRanges {
47
+ readonly accelerometerG: number | undefined;
48
+ readonly gyroscopeDps: number | undefined;
49
+ }
50
+ interface WindowCrop {
51
+ readonly sensorWidth: number | undefined;
52
+ readonly sensorHeight: number | undefined;
53
+ readonly cropWidth: number | undefined;
54
+ readonly cropHeight: number | undefined;
55
+ readonly cropOffsetX: number | undefined;
56
+ readonly cropOffsetY: number | undefined;
57
+ }
58
+ interface CalibrationStrings {
59
+ readonly offset: string | undefined;
60
+ readonly offsetV2: string | undefined;
61
+ readonly offsetV3: string | undefined;
62
+ }
63
+ /**
64
+ * Everything the player learns from the info record. Absent fields are `undefined`; nothing here
65
+ * is assumed present except on cameras where a field has been observed.
66
+ */
67
+ export interface RecordingInfo {
68
+ readonly serialNumber: string | undefined;
69
+ readonly model: string | undefined;
70
+ readonly firmware: string | undefined;
71
+ readonly calibration: CalibrationStrings;
72
+ readonly dimension: LensDimension | undefined;
73
+ readonly frameRate: number | undefined;
74
+ readonly captureMode: string | undefined;
75
+ /**
76
+ * Capture-clock time of the first encoded frame, in the unit the gyro record uses
77
+ * (microseconds for the raw layout, milliseconds for the float layout). Resolve it through
78
+ * `firstFrameCaptureTime`, never by hand.
79
+ */
80
+ readonly firstFrameTimestamp: number | undefined;
81
+ /**
82
+ * Rolling-shutter readout duration of one frame.
83
+ */
84
+ readonly readoutTime: Seconds | undefined;
85
+ readonly windowCrop: WindowCrop | undefined;
86
+ /**
87
+ * How much later than the frames the gyro samples are stamped.
88
+ */
89
+ readonly gyroOffset: Milliseconds | undefined;
90
+ readonly gyroType: number | undefined;
91
+ readonly isRawGyro: boolean | undefined;
92
+ /**
93
+ * The frame time source the camera says to trust first (`pts_type`).
94
+ */
95
+ readonly preferredFrameTimeSource: FrameTimeSourceName | undefined;
96
+ readonly sensorRanges: SensorRanges | undefined;
97
+ readonly fileLayout: FileLayoutHint | undefined;
98
+ readonly trackOrder: TrackOrderHint | undefined;
99
+ }
100
+ type TrailerWrapper = "inst-box" | "bare";
101
+ /**
102
+ * One top-level box of the file: its four-character type, where it starts and how long it is.
103
+ */
104
+ export interface BoxSummary {
105
+ readonly type: string;
106
+ readonly offset: number;
107
+ readonly size: number;
108
+ }
109
+ export interface RecordSummary {
110
+ readonly id: number;
111
+ readonly format: number;
112
+ readonly offset: number;
113
+ readonly size: number;
114
+ }
115
+ export interface LensSummary {
116
+ readonly lensIndex: number;
117
+ readonly model: string;
118
+ readonly principalPoint: readonly [
119
+ x: number,
120
+ y: number
121
+ ];
122
+ readonly orientationDegrees: readonly [
123
+ yaw: number,
124
+ pitch: number,
125
+ roll: number
126
+ ];
127
+ readonly translationMetres: readonly [
128
+ x: number,
129
+ y: number,
130
+ z: number
131
+ ];
132
+ }
133
+ export interface CalibrationSummary {
134
+ readonly version: CalibrationVersion;
135
+ readonly canvas: readonly [
136
+ width: number,
137
+ height: number
138
+ ];
139
+ readonly lenses: readonly LensSummary[];
140
+ }
141
+ export interface GyroSummary {
142
+ readonly layout: string;
143
+ readonly samples: number;
144
+ readonly strayBytes: number;
145
+ /**
146
+ * Samples left out because their bytes cannot be a reading; a wrong layout guess shows here.
147
+ */
148
+ readonly damagedSamples: number;
149
+ /**
150
+ * Stamps put back where their neighbours say they belong: glitched stamps. A wrong stamp unit
151
+ * scales them all alike and shows in the mean interval and the span instead.
152
+ */
153
+ readonly mendedStamps: number;
154
+ readonly spanSeconds: number;
155
+ readonly meanIntervalUs: number | undefined;
156
+ /**
157
+ * Mean |acceleration| over the leading samples; about 1 g proves the range scaling. Undefined
158
+ * for a record without samples.
159
+ */
160
+ readonly meanAccelerationMagnitudeG: number | undefined;
161
+ }
162
+ /**
163
+ * A gyro record whose sample layout could not be told, and why.
164
+ */
165
+ export interface UnreadableGyro {
166
+ readonly unreadable: string;
167
+ }
168
+ /**
169
+ * An exposure record the trailer lists that did not parse: an entry no clock could have stamped
170
+ * or no shutter could take.
171
+ */
172
+ export interface DamagedExposure {
173
+ readonly damaged: true;
174
+ }
175
+ /**
176
+ * An exposure record the trailer lists that was not read, and why.
177
+ */
178
+ export interface UnreadExposure {
179
+ readonly unread: string;
180
+ }
181
+ /**
182
+ * The record's entries; the times and the mean are undefined for a record without any, so the
183
+ * summary stays plain data that serializes as it reads.
184
+ */
185
+ export interface ExposureSummary {
186
+ readonly entries: number;
187
+ readonly firstCaptureTimeUs: number | undefined;
188
+ readonly lastCaptureTimeUs: number | undefined;
189
+ readonly meanShutterTimeSeconds: number | undefined;
190
+ /**
191
+ * Index of the entry that belongs to the first encoded frame, when the info record says.
192
+ */
193
+ readonly firstEncodedFrameEntry: number | undefined;
194
+ }
195
+ export type ExposureReport = ExposureSummary | DamagedExposure | UnreadExposure;
196
+ /**
197
+ * What a recording's file holds, as plain data: its boxes, the trailer and its records, the info
198
+ * record, the calibration and summaries of the gyro and exposure records. Serializable, so a
199
+ * report, a page or a test can take it without the domain objects.
200
+ */
201
+ export interface RecordingInspection {
202
+ readonly fileSize: number;
203
+ readonly boxes: readonly BoxSummary[];
204
+ readonly trailerWrapper: TrailerWrapper;
205
+ readonly trailerVersion: number;
206
+ readonly payloadStart: number;
207
+ readonly records: readonly RecordSummary[];
208
+ readonly info: RecordingInfo;
209
+ /**
210
+ * Undefined when the recording carries no usable calibration string.
211
+ */
212
+ readonly calibration: CalibrationSummary | undefined;
213
+ /**
214
+ * Why calibration strings were skipped, whether or not one was usable.
215
+ */
216
+ readonly calibrationWarnings: readonly string[];
217
+ readonly gyro: GyroSummary | UnreadableGyro | undefined;
218
+ readonly exposure: ExposureReport | undefined;
219
+ }
220
+ interface VideoTrackDescription {
221
+ readonly trackIndex: number;
222
+ readonly codedWidth: number;
223
+ readonly codedHeight: number;
224
+ /**
225
+ * WebCodecs codec string, for example `hvc1.1.6.L153.B0` or `avc1.640033`.
226
+ */
227
+ readonly codec: string;
228
+ }
229
+ export type StabilizationMode = "off" | "lock" | "horizon" | "follow";
230
+ export declare const STABILIZATION_MODES: readonly StabilizationMode[];
231
+ /**
232
+ * How finely the renderer reads the lens images for each screen pixel, and how many device pixels
233
+ * per CSS pixel the drawing buffer may hold ({@link pixelRatioCapOf}): `fast` reads one bilinear
234
+ * tap of the frame as decoded; `balanced` reads through a mip chain over the pixel's footprint,
235
+ * which stops the shimmer where the frame is minified; `high` adds extra taps (ADR 0024).
236
+ */
237
+ export type PictureQuality = "fast" | "balanced" | "high";
238
+ export declare const PICTURE_QUALITIES: readonly PictureQuality[];
239
+ interface ScreenPoint {
240
+ readonly x: number;
241
+ readonly y: number;
242
+ }
243
+ interface DragDelta {
244
+ readonly x: number;
245
+ readonly y: number;
246
+ }
247
+ /**
248
+ * What the player shows: `raw-lenses` is each lens's decoded image on its own, unstitched, and
249
+ * what the player opens on; `equirectangular` is the whole stitched sphere as a 2:1 panorama;
250
+ * `normal` is a rectilinear window into the stitched sphere that the viewer turns and zooms.
251
+ * The order is the view menu's, first to last (ADR 0022).
252
+ */
253
+ export type ViewMode = "raw-lenses" | "equirectangular" | "normal";
254
+ export declare const VIEW_MODES: readonly ViewMode[];
255
+ /**
256
+ * Stable machine-readable failure categories. Embedders switch on these; messages are for humans.
257
+ */
258
+ export declare const GYRO_VIEW_ERROR_CODES: readonly [
259
+ "binary-out-of-bounds",
260
+ "binary-unsafe-integer",
261
+ "codec-unsupported",
262
+ "cors",
263
+ "decode",
264
+ "embed-destroyed",
265
+ "index-out-of-range",
266
+ "invalid-argument",
267
+ "invalid-byte-range",
268
+ "invalid-calibration",
269
+ "invalid-protobuf",
270
+ "invalid-trailer",
271
+ "invariant-violation",
272
+ "missing-second-file",
273
+ "no-calibration",
274
+ "no-info-record",
275
+ "no-key-frame",
276
+ "playback-blocked",
277
+ "range-unsupported",
278
+ "render-unavailable",
279
+ "source-truncated",
280
+ "source-unreadable",
281
+ "unsupported-calibration",
282
+ "unsupported-container",
283
+ "unsupported-gyro-record",
284
+ "unsupported-info-format",
285
+ "unsupported-layout"
286
+ ];
287
+ export type GyroViewErrorCode = (typeof GYRO_VIEW_ERROR_CODES)[number];
288
+ export declare function isGyroViewErrorCode(value: unknown): value is GyroViewErrorCode;
289
+ export declare class GyroViewError extends Error {
290
+ readonly code: GyroViewErrorCode;
291
+ constructor(code: GyroViewErrorCode, message: string, options?: ErrorOptions);
292
+ }
293
+ export declare function hasErrorCode(error: unknown, code: GyroViewErrorCode): boolean;
294
+ type Listener<Payload> = (payload: Payload) => void;
295
+ declare class TypedEmitter<Events extends object> {
296
+ private readonly reportListenerError;
297
+ private readonly listeners;
298
+ constructor(reportListenerError?: (error: unknown) => void);
299
+ on<Name extends keyof Events>(name: Name, listener: Listener<Events[Name]>): () => void;
300
+ /**
301
+ * The listeners there when the emit began hear it, as `dispatchEvent` delivers: one added
302
+ * meanwhile waits for the next emit, so a listener that subscribes itself again runs once, and
303
+ * one removed meanwhile hears no more.
304
+ */
305
+ emit<Name extends keyof Events>(name: Name, payload: Events[Name]): void;
306
+ /**
307
+ * The listeners of an event under way are dropped too, as an unsubscribe drops one: whoever
308
+ * removed them is past hearing from them.
309
+ */
310
+ removeAll(): void;
311
+ }
312
+ type PlayerState = "ready" | "playing" | "buffering" | "paused" | "seeking" | "ended" | "error" | "disposed";
313
+ export interface ImuFrameSummary {
314
+ readonly name: string;
315
+ readonly isVerified: boolean;
316
+ }
317
+ /**
318
+ * What the player learned about a recording while opening it, for the `ready` event: enough for
319
+ * an embedder to know which camera, layout and degraded features it got.
320
+ */
321
+ export interface PlayerMetadata {
322
+ readonly model: string | undefined;
323
+ readonly firmware: string | undefined;
324
+ readonly captureMode: string | undefined;
325
+ readonly layout: LensLayoutKind;
326
+ readonly layoutEvidence: readonly string[];
327
+ /**
328
+ * The lens tracks in lens order.
329
+ */
330
+ readonly tracks: readonly VideoTrackDescription[];
331
+ readonly calibrationVersion: CalibrationVersion;
332
+ readonly frameTimeSource: FrameTimeSourceName | undefined;
333
+ readonly hasGyro: boolean;
334
+ readonly imuFrame: ImuFrameSummary | undefined;
335
+ readonly hasAudio: boolean;
336
+ /**
337
+ * In seconds.
338
+ */
339
+ readonly duration: number;
340
+ }
341
+ /**
342
+ * The DOM the pipeline draws on and plays sound through; both borrowed from the element.
343
+ */
344
+ export interface PipelineHost {
345
+ readonly canvas: HTMLCanvasElement;
346
+ readonly audio: HTMLMediaElement;
347
+ }
348
+ /**
349
+ * A view as a page gives it and gets it back: yaw positive to the right, pitch positive up, and
350
+ * the horizontal field of view, all in degrees.
351
+ */
352
+ export interface ViewAngles {
353
+ readonly yaw: number;
354
+ readonly pitch: number;
355
+ readonly fieldOfView: number;
356
+ }
357
+ /**
358
+ * What concerns one load only. The settings (view, view mode, stabilization, gain matching,
359
+ * sound, loop) belong to the player and carry over from load to load; set them on the player.
360
+ */
361
+ export interface LoadOptions {
362
+ /**
363
+ * Start as soon as the recording is ready; a refusal by the autoplay policy is a warning.
364
+ */
365
+ readonly autoplay?: boolean;
366
+ /**
367
+ * Decode the first frame as soon as the recording is ready, so it shows instead of a black
368
+ * canvas. Default true; off keeps the decoders idle until play.
369
+ */
370
+ readonly preload?: boolean;
371
+ }
372
+ /**
373
+ * The session's states plus the two only the player knows: nothing loaded, and loading.
374
+ */
375
+ export type PlayerStatus = "idle" | "loading" | PlayerState;
376
+ /**
377
+ * The sound as it is now: volume from 0 to 1, and whether it is muted.
378
+ */
379
+ export interface SoundLevel {
380
+ readonly volume: number;
381
+ readonly isMuted: boolean;
382
+ }
383
+ /**
384
+ * What a `warning` is about, for a page that acts on some and not others:
385
+ * - `recording-degraded`: the recording lacks, or has damaged, data the player works around (no
386
+ * gyro, an unverified IMU frame, fallback frame times or calibration); `ready`'s metadata says
387
+ * what it got.
388
+ * - `no-sound`: the recording has no sound, or none this browser plays; a silent clock runs.
389
+ * - `autoplay-blocked`: the browser waits for a user gesture before it starts playback.
390
+ * - `playback-failed`: a start (a press, autoplay, the loop) or the seek bar's preview failed.
391
+ * - `ignored-attribute`: an attribute's value names nothing the element knows; the setting stays.
392
+ * - `refused-property`: a property set before the element was defined was refused.
393
+ */
394
+ export type WarningCode = "recording-degraded" | "no-sound" | "autoplay-blocked" | "playback-failed" | "ignored-attribute" | "refused-property";
395
+ export interface PlayerWarning {
396
+ readonly code: WarningCode;
397
+ /**
398
+ * What happened exactly, for a developer.
399
+ */
400
+ readonly message: string;
401
+ }
402
+ export interface PlayerEvents {
403
+ readonly statuschange: PlayerStatus;
404
+ readonly ready: PlayerMetadata;
405
+ readonly play: undefined;
406
+ /**
407
+ * Frames are ready and the clock runs: after `play` or after `waiting`.
408
+ */
409
+ readonly playing: undefined;
410
+ /**
411
+ * Playback holds for frames: on starting, after a seek, or when decoding falls behind.
412
+ */
413
+ readonly waiting: undefined;
414
+ readonly pause: undefined;
415
+ readonly ended: undefined;
416
+ /**
417
+ * The media time, every quarter second of playback and on a pause, a seek or the end.
418
+ */
419
+ readonly timeupdate: number;
420
+ readonly seeking: number;
421
+ readonly seeked: number;
422
+ /**
423
+ * A picture was drawn; the media time it shows.
424
+ */
425
+ readonly frame: number;
426
+ readonly viewchange: ViewAngles;
427
+ readonly viewmodechange: ViewMode;
428
+ readonly stabilizationchange: StabilizationMode;
429
+ /**
430
+ * The picture quality changed, to the one named.
431
+ */
432
+ readonly qualitychange: PictureQuality;
433
+ /**
434
+ * The volume or the mute changed, from whatever changed it.
435
+ */
436
+ readonly volumechange: SoundLevel;
437
+ /**
438
+ * Something the player worked around; the code says what, the message says it exactly.
439
+ */
440
+ readonly warning: PlayerWarning;
441
+ readonly error: GyroViewError;
442
+ }
443
+ /**
444
+ * The player without the element, which `createBrowserPlayer` gives: it plays one recording at a
445
+ * time on the canvas and audio element it was handed, reports in media-element events, and keeps
446
+ * its settings (view, view mode, stabilization, gain matching, sound, loop) from load to load.
447
+ * `<gyro-view>` is a facade over it.
448
+ */
449
+ export declare class Player {
450
+ private readonly parts;
451
+ readonly events: TypedEmitter<PlayerEvents>;
452
+ /**
453
+ * What the player and its parts announce, heard once each change is whole (ADR 0021).
454
+ */
455
+ private readonly outbox;
456
+ private readonly loop;
457
+ private phase;
458
+ private readonly viewing;
459
+ private readonly picture;
460
+ /**
461
+ * A seek asked for before a recording was ready, where the next one starts.
462
+ */
463
+ private pendingStartTime;
464
+ private readonly sound;
465
+ private readonly relay;
466
+ private isLoopingValue;
467
+ /**
468
+ * Past `dispose`: a listener of the idle it announces must not load again.
469
+ */
470
+ private isDisposed;
471
+ /**
472
+ * The status listeners heard last.
473
+ */
474
+ private lastStatus;
475
+ get status(): PlayerStatus;
476
+ get metadata(): PlayerMetadata | undefined;
477
+ get currentTime(): number;
478
+ get duration(): number;
479
+ /**
480
+ * False while playing or holding for frames, as a media element's `paused`.
481
+ */
482
+ get isPaused(): boolean;
483
+ get view(): ViewAngles;
484
+ get viewMode(): ViewMode;
485
+ /**
486
+ * Whether a drag moves the picture as it is framed now; the view mode decides.
487
+ */
488
+ get canPan(): boolean;
489
+ get stabilization(): StabilizationMode;
490
+ get quality(): PictureQuality;
491
+ get isLooping(): boolean;
492
+ get volume(): number;
493
+ get isMuted(): boolean;
494
+ /**
495
+ * Whether `setVolume` changes anything on this platform; iOS leaves media at the device's volume.
496
+ */
497
+ get canSetVolume(): boolean;
498
+ /**
499
+ * Replaces whatever was loaded. Resolves once the recording is ready (and started, with
500
+ * `autoplay`); rejects with the failure after reporting it as an `error` event. A load that a
501
+ * newer load or `unload` supersedes resolves quietly.
502
+ */
503
+ load(source: PlayerSource, options?: LoadOptions): Promise<void>;
504
+ unload(): void;
505
+ /**
506
+ * Starts playback, after a load in progress is ready, as a media element's `play()` does.
507
+ * Rejects with the load's failure, or with `playback-blocked` when the browser wants a user
508
+ * gesture first; with nothing loaded there is nothing to start.
509
+ */
510
+ play(): Promise<void>;
511
+ pause(): void;
512
+ stop(): void;
513
+ /**
514
+ * Seeks exactly to `time` seconds; while a recording is loading, before one is, or after its
515
+ * playback failed, the next one starts there, as a media element's default playback start
516
+ * position has it.
517
+ */
518
+ seek(time: number): void;
519
+ /**
520
+ * Seeks to the key frame at or before `time` seconds: quick to show while a seek bar is dragged.
521
+ */
522
+ scrub(time: number): Promise<void>;
523
+ setView(view: ViewAngles): void;
524
+ /**
525
+ * Points the normal view at `yaw` and `pitch`, in degrees: yaw positive to the right, pitch
526
+ * positive up.
527
+ */
528
+ lookAt(yaw: number, pitch: number): void;
529
+ /**
530
+ * The viewer dragged the picture by `delta` CSS pixels across the canvas.
531
+ */
532
+ pan(delta: DragDelta): void;
533
+ /**
534
+ * The viewer turned by the given angles in degrees, as the arrow keys do.
535
+ */
536
+ turn(yawDelta: number, pitchDelta: number): void;
537
+ /**
538
+ * Zooms by `steps` (positive zooms in) toward `focus`, a point of the canvas as fractions of its
539
+ * size; about the centre when none is given.
540
+ */
541
+ zoom(steps: number, focus?: ScreenPoint): void;
542
+ resetView(): void;
543
+ setViewMode(mode: ViewMode): void;
544
+ setStabilization(mode: StabilizationMode): void;
545
+ /**
546
+ * How finely the lens images are read and how many device pixels are drawn; kept across loads.
547
+ */
548
+ setQuality(quality: PictureQuality): void;
549
+ setLooping(isLooping: boolean): void;
550
+ /**
551
+ * Whether the lenses' exposure is matched along the seam; kept across loads.
552
+ */
553
+ setGainMatching(isEnabled: boolean): void;
554
+ setVolume(volume: number): void;
555
+ setMuted(isMuted: boolean): void;
556
+ dispose(): void;
557
+ private readonly tick;
558
+ /**
559
+ * Whatever it ends in: a failure is the load's to report, and `play` reads it from the phase.
560
+ */
561
+ private loadInProgress;
562
+ private get loaded();
563
+ private complete;
564
+ private startAtPendingTime;
565
+ private attach;
566
+ /**
567
+ * A refused start leaves the recording loaded and paused: a warning, never a failed load.
568
+ */
569
+ private autoplay;
570
+ private onEnded;
571
+ private replay;
572
+ /**
573
+ * Lets go of whatever is loading or loaded, announcing nothing.
574
+ */
575
+ private release;
576
+ private failWith;
577
+ /**
578
+ * Announces the status the phase gives now, heard once for each change: a status announced
579
+ * again before listeners heard the other one in between is heard once.
580
+ */
581
+ private announceStatus;
582
+ }
583
+ /**
584
+ * The element's labels: what its buttons, sliders, menus and overlays are called, and its own
585
+ * name for assistive technology.
586
+ */
587
+ export interface GyroViewLabels {
588
+ /**
589
+ * The element's name, unless the page names it.
590
+ */
591
+ readonly player: string;
592
+ readonly loading: string;
593
+ readonly play: string;
594
+ readonly pause: string;
595
+ readonly stop: string;
596
+ readonly seek: string;
597
+ /**
598
+ * How the seek bar tells assistive technology where it is: `{time}` and `{duration}` are
599
+ * replaced.
600
+ */
601
+ readonly position: string;
602
+ readonly mute: string;
603
+ readonly volume: string;
604
+ readonly resetView: string;
605
+ readonly stabilization: string;
606
+ readonly viewMode: string;
607
+ readonly fullscreen: string;
608
+ }
609
+ type LabelName = keyof GyroViewLabels;
610
+ /**
611
+ * Every word `<gyro-view>` shows, or says to assistive technology: English by default, each
612
+ * replaceable through the element's `messages` property.
613
+ */
614
+ export interface GyroViewMessages {
615
+ readonly labels: GyroViewLabels;
616
+ readonly stabilizationModes: Readonly<Record<StabilizationMode, string>>;
617
+ readonly viewModes: Readonly<Record<ViewMode, string>>;
618
+ /**
619
+ * What a visitor reads when a recording cannot play, by the failure's code. The `error`
620
+ * event carries the developer's account of it.
621
+ */
622
+ readonly errors: Readonly<Record<GyroViewErrorCode, string>>;
623
+ }
624
+ /**
625
+ * The words a page gives: any of them, table by table.
626
+ */
627
+ export type GyroViewMessageOverrides = {
628
+ readonly [Table in keyof GyroViewMessages]?: Partial<GyroViewMessages[Table]>;
629
+ };
630
+ declare class Wording {
631
+ private words;
632
+ get current(): GyroViewMessages;
633
+ /**
634
+ * The defaults with the page's own words in their place; `write` shows them.
635
+ */
636
+ replace(overrides: unknown): void;
637
+ /**
638
+ * Calls `element` by the label `name` names, now and after every change of words.
639
+ */
640
+ label(element: Element, name: LabelName): void;
641
+ /**
642
+ * Tells the visitor in `element` that the recording failed with `code`.
643
+ */
644
+ showError(element: Element, code: GyroViewErrorCode): void;
645
+ /**
646
+ * Fills in every word below `root` that its markup names.
647
+ */
648
+ write(root: ParentNode): void;
649
+ private writeLabel;
650
+ private writeText;
651
+ private writeChoices;
652
+ private writeError;
653
+ }
654
+ interface ControlsHost {
655
+ readonly player: Player;
656
+ /**
657
+ * The words the controls say, the page's where it gave its own.
658
+ */
659
+ readonly wording: Wording;
660
+ /**
661
+ * Plays or pauses; the element reports a refused start.
662
+ */
663
+ togglePlay(): void;
664
+ toggleFullscreen(): void;
665
+ warn(warning: PlayerWarning): void;
666
+ }
667
+ interface KeyboardHost extends Pick<ControlsHost, "togglePlay" | "toggleFullscreen"> {
668
+ readonly player: Pick<Player, "currentTime" | "seek" | "stop" | "turn" | "zoom" | "resetView" | "isMuted" | "setMuted">;
669
+ readonly isFullscreen: () => boolean;
670
+ exitFullscreen(): void;
671
+ }
672
+ type PlaybackToggle = Pick<Player, "isPaused" | "pause" | "play" | "events">;
673
+ export interface ViewGestureOptions {
674
+ /**
675
+ * Hears a tap on the surface, a press without a drag, with the kind of pointer that made it
676
+ * (`mouse`, `touch`, `pen`). By default a tap plays or pauses, as on `<gyro-view>`.
677
+ */
678
+ readonly onTap?: (pointerType: string) => void;
679
+ }
680
+ export interface KeyboardOptions {
681
+ /**
682
+ * What F does; by default the target fills the screen through the Fullscreen API, which
683
+ * iPhone Safari offers to video elements only.
684
+ */
685
+ readonly toggleFullscreen?: () => void;
686
+ }
687
+ /**
688
+ * The gestures `<gyro-view>` answers, for an interface of a page's own around the headless
689
+ * player: a drag looks around (or moves a zoomed picture), a pinch or a wheel turn zooms toward
690
+ * the fingers or the pointer, a tap plays or pauses. `surface` is the canvas or an element over
691
+ * it. Returns what removes them.
692
+ */
693
+ export declare function attachViewGestures(surface: HTMLElement, player: Pick<Player, "pan" | "zoom" | "canPan"> & PlaybackToggle, options?: ViewGestureOptions): () => void;
694
+ /**
695
+ * The keyboard shortcuts `<gyro-view>` answers, on `target`, which a page makes focusable: space
696
+ * or K play and pause, J and L seek, S stops, the arrows look around (with Shift they seek), plus
697
+ * and minus zoom, 0 resets the view, M mutes, F fills the screen and Escape leaves it. Returns
698
+ * what removes them.
699
+ */
700
+ export declare function attachKeyboard(target: HTMLElement, player: KeyboardHost["player"] & PlaybackToggle, options?: KeyboardOptions): () => void;
701
+ interface HttpRequestOptions {
702
+ /**
703
+ * Extra request settings, for example credentials or headers. `Range` is set by the caller.
704
+ * Requests bypass the browser's HTTP cache unless these settings choose another `cache` mode.
705
+ */
706
+ readonly requestInit?: RequestInit;
707
+ readonly fetch?: typeof fetch;
708
+ }
709
+ export interface BrowserPortsOptions {
710
+ /**
711
+ * Shared by every request the player makes for the recording and its other lens file.
712
+ */
713
+ readonly http?: HttpRequestOptions;
714
+ /**
715
+ * How long the decode probe may take before a lens is reported as timed out. Default 15 s,
716
+ * generous because hardware decoders wake slowly.
717
+ */
718
+ readonly probeTimeoutMs?: number;
719
+ }
720
+ /**
721
+ * A player composed for a browser: HTTP, blob and WebCodecs ports and the GPU pipeline, drawing
722
+ * on the host's canvas and sounding through its audio element. What `<gyro-view>` plays with,
723
+ * and where a page that wants the player without the element starts.
724
+ */
725
+ export declare function createBrowserPlayer(host: PipelineHost, options?: BrowserPortsOptions): Player;
726
+ export interface InspectOptions extends Pick<BrowserPortsOptions, "http"> {
727
+ /**
728
+ * Abandons the requests for a URL; the inspection then rejects.
729
+ */
730
+ readonly signal?: AbortSignal;
731
+ }
732
+ /**
733
+ * Reads what a recording's file holds without playing it (see `RecordingInspection`): from a URL,
734
+ * in byte ranges as playback reads it, or from a `Blob`, such as a `File` from a picker. Rejects
735
+ * with the `GyroViewError` a load would meet, for example `cors` or `invalid-trailer`.
736
+ */
737
+ export declare function inspectRecording(recording: Blob | string, options?: InspectOptions): Promise<RecordingInspection>;
738
+ /**
739
+ * Local files to play, from a picker or a drop.
740
+ */
741
+ export interface FileSource {
742
+ readonly main: File;
743
+ readonly second?: File;
744
+ }
745
+ interface LiveSettings {
746
+ stabilization: StabilizationMode;
747
+ viewMode: ViewMode;
748
+ quality: PictureQuality;
749
+ fov: number;
750
+ yaw: number;
751
+ pitch: number;
752
+ muted: boolean;
753
+ loop: boolean;
754
+ volume: number;
755
+ }
756
+ /**
757
+ * The events `<gyro-view>` dispatches: each player event as a `CustomEvent` of the same name,
758
+ * its payload in `detail`. They take the place of the element events some share a name with
759
+ * (`play`, `pause`, `error`...), which a custom element never fires itself.
760
+ */
761
+ export type GyroViewElementEventMap = Omit<HTMLElementEventMap, keyof PlayerEvents> & {
762
+ readonly [Name in keyof PlayerEvents]: CustomEvent<PlayerEvents[Name]>;
763
+ };
764
+ declare const ElementBase: typeof HTMLElement;
765
+ declare class TypedEventElement extends ElementBase {
766
+ addEventListener<Name extends keyof GyroViewElementEventMap>(type: Name, listener: (this: this, event: GyroViewElementEventMap[Name]) => unknown, options?: boolean | AddEventListenerOptions): void;
767
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
768
+ removeEventListener<Name extends keyof GyroViewElementEventMap>(type: Name, listener: (this: this, event: GyroViewElementEventMap[Name]) => unknown, options?: boolean | EventListenerOptions): void;
769
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
770
+ }
771
+ /**
772
+ * `<gyro-view>`: the player as an element. Attributes name what to play and configure the
773
+ * settings; the settings' properties report what is in effect now, as a media element's `muted`
774
+ * does; the player's events are dispatched as `CustomEvent`s of the same name with the payload
775
+ * in `detail`. Facade over {@link Player}, the controls and the gestures (ADR 0016).
776
+ */
777
+ export declare class GyroViewElement extends TypedEventElement implements LiveSettings {
778
+ static readonly observedAttributes: readonly string[];
779
+ src: string | null;
780
+ src2: string | null;
781
+ poster: string | null;
782
+ preload: "none" | "auto";
783
+ gainMatch: "on" | "off";
784
+ autoplay: boolean;
785
+ controls: boolean;
786
+ stabilization: StabilizationMode;
787
+ viewMode: ViewMode;
788
+ quality: PictureQuality;
789
+ fov: number;
790
+ yaw: number;
791
+ pitch: number;
792
+ muted: boolean;
793
+ loop: boolean;
794
+ volume: number;
795
+ /**
796
+ * Properties the page set before the element was defined, kept until it is connected.
797
+ */
798
+ private readonly earlyProperties;
799
+ private readonly player;
800
+ private readonly loads;
801
+ private readonly wording;
802
+ private readonly fullscreen;
803
+ private readonly idle;
804
+ private readonly posterImage;
805
+ constructor();
806
+ /**
807
+ * Where the player is: `idle` or `loading`, then the loaded recording's playback state.
808
+ */
809
+ get status(): PlayerStatus;
810
+ /**
811
+ * What the player learned about the loaded recording; undefined until it is ready.
812
+ */
813
+ get metadata(): PlayerMetadata | undefined;
814
+ /**
815
+ * The media time shown, in seconds; setting it seeks there exactly.
816
+ */
817
+ get currentTime(): number;
818
+ set currentTime(time: number);
819
+ /**
820
+ * The loaded recording's length in seconds; 0 without one.
821
+ */
822
+ get duration(): number;
823
+ /**
824
+ * True unless playback is under way or waiting for data to go on, as a media element's.
825
+ */
826
+ get paused(): boolean;
827
+ /**
828
+ * Where the normal view looks: yaw and pitch in degrees, and the horizontal field of view.
829
+ */
830
+ get view(): ViewAngles;
831
+ /**
832
+ * Every word the element shows or says to assistive technology. Setting it replaces any of
833
+ * them, table by table (`labels`, `stabilizationModes`, `viewModes`, `errors`); the others keep
834
+ * their English defaults, and `null` brings them all back.
835
+ */
836
+ get messages(): GyroViewMessages;
837
+ set messages(overrides: GyroViewMessageOverrides | null | undefined);
838
+ connectedCallback(): void;
839
+ disconnectedCallback(): void;
840
+ attributeChangedCallback(name: string, _previous: string | null, value: string | null): void;
841
+ /**
842
+ * Starts playing, waiting for a load in progress, or one the attributes set just now asked
843
+ * for; rejects when the browser refuses to start.
844
+ */
845
+ play(): Promise<void>;
846
+ /**
847
+ * Pauses, keeping the frame on screen.
848
+ */
849
+ pause(): void;
850
+ /**
851
+ * Pauses and goes back to the start.
852
+ */
853
+ stop(): void;
854
+ /**
855
+ * Seeks exactly to `time` seconds; right after a new `src`, the new recording starts there.
856
+ */
857
+ seek(time: number): void;
858
+ /**
859
+ * Seeks to the key frame at or before `time`: quick to show while a seek bar is dragged.
860
+ */
861
+ scrub(time: number): Promise<void>;
862
+ /**
863
+ * Points the normal view at `yaw` and `pitch`, in degrees: yaw positive to the right, pitch
864
+ * positive up.
865
+ */
866
+ lookAt(yaw: number, pitch: number): void;
867
+ /**
868
+ * Brings the current view mode back to how it starts, the others keeping their framing.
869
+ */
870
+ resetView(): void;
871
+ /**
872
+ * Zooms by `steps` (positive zooms in, each step by a factor of 1.1, within each view mode's
873
+ * limits) toward `focus`, a point of the picture as fractions of its size; about the centre
874
+ * when none is given.
875
+ */
876
+ zoom(steps: number, focus?: ScreenPoint): void;
877
+ /**
878
+ * Stabilizes the picture in `mode` (`off`, `lock`, `horizon`, `follow`); any other value,
879
+ * an unset one included, is refused.
880
+ */
881
+ setStabilization(mode: StabilizationMode): void;
882
+ /**
883
+ * Shows the picture in `mode` (`raw-lenses`, `equirectangular`, `normal`); any other value,
884
+ * an unset one included, is refused.
885
+ */
886
+ setViewMode(mode: ViewMode): void;
887
+ /**
888
+ * Reads the lens images as `quality` says (`fast`, `balanced`, `high`); any other value, an
889
+ * unset one included, is refused.
890
+ */
891
+ setQuality(quality: PictureQuality): void;
892
+ /**
893
+ * Fills the screen with the player, through the Fullscreen API or pinned over the page, or
894
+ * leaves it.
895
+ */
896
+ toggleFullscreen(): Promise<void>;
897
+ /**
898
+ * Loads what the attributes (or the files handed in) name: the change already waiting to be
899
+ * read, or else now; out of the document, once connected. Resolves once the recording is
900
+ * ready; rejects with the failure, which is dispatched as an `error` event too.
901
+ */
902
+ load(): Promise<void>;
903
+ /**
904
+ * Plays local files instead of the `src` attributes, until `src` or `src2` change.
905
+ */
906
+ loadFiles(files: FileSource): void;
907
+ /**
908
+ * What the controls and the keyboard ask of the element. They live as long as the element:
909
+ * their listeners sit on its own shadow tree and host, and on its player.
910
+ */
911
+ private controlsHost;
912
+ /**
913
+ * A tap on the picture toggles playback, except a touch that brought hidden controls back:
914
+ * touch has no hover to reveal them, so that tap is the viewer asking to see them. Without
915
+ * controls there is nothing to reveal, and every tap toggles.
916
+ */
917
+ private readonly onPictureTap;
918
+ /**
919
+ * Pauses, or starts playing and reports a refused start as a warning.
920
+ */
921
+ private readonly togglePlayback;
922
+ private readonly warn;
923
+ }
924
+ /**
925
+ * The attributes `<gyro-view>` takes, for a framework's JSX declaration of the element (React,
926
+ * Preact, Solid): each is optional, a number may be given as text, and a boolean attribute is
927
+ * set by `true`.
928
+ */
929
+ export interface GyroViewAttributes {
930
+ readonly src?: string | undefined;
931
+ readonly src2?: string | undefined;
932
+ readonly poster?: string | undefined;
933
+ readonly preload?: "none" | "auto" | undefined;
934
+ readonly "gain-match"?: "on" | "off" | undefined;
935
+ readonly autoplay?: boolean | undefined;
936
+ readonly muted?: boolean | undefined;
937
+ readonly loop?: boolean | undefined;
938
+ readonly controls?: boolean | undefined;
939
+ readonly stabilization?: StabilizationMode | undefined;
940
+ readonly "view-mode"?: ViewMode | undefined;
941
+ readonly quality?: PictureQuality | undefined;
942
+ readonly fov?: number | string | undefined;
943
+ readonly yaw?: number | string | undefined;
944
+ readonly pitch?: number | string | undefined;
945
+ }
946
+ export declare const GYRO_VIEW_TAG = "gyro-view";
947
+ declare global {
948
+ interface HTMLElementTagNameMap {
949
+ [GYRO_VIEW_TAG]: GyroViewElement;
950
+ }
951
+ }
952
+ /**
953
+ * Registers `<gyro-view>` once. A page that loads the package twice keeps the first definition,
954
+ * and hears once that another copy was there first, which may be another version. Without a
955
+ * custom element registry (a server rendering the page) there is nothing to register.
956
+ */
957
+ export declare function defineGyroView(): void;
958
+
959
+ export {};