@kieransimkin/dancemoves 3.1.19 → 3.1.21

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/AGENTS.md CHANGED
@@ -7,3 +7,9 @@
7
7
  - Keep credentials, account data, private media and rights records out of source, fixtures, logs and packages. Use synthetic fixtures or explicitly authorised public examples and preserve their provenance/licences.
8
8
  - Use [CONTRIBUTING.md](CONTRIBUTING.md) for review. Maintainers publish accepted, validated improvements as a fresh matching GitHub release and verify configured registry destinations. Preserve existing tags and release assets; publication and deployment remain subject to applicable authorisation.
9
9
  - Website: https://kieransimkin.co.uk/danceflow/
10
+
11
+ ## Keep README documentation current
12
+
13
+ - Whenever a feature is added or changed, update the relevant README.md in the same change to reflect the resulting behaviour. This applies to every feature addition or modification, including APIs, commands, configuration, defaults, integrations and removals.
14
+ - Update affected feature descriptions, usage instructions, options, examples and limitations. For tools or packages with their own README.md, update that README as well as the repository README when its overview or usage is affected.
15
+ - Check the README against the implemented and verified behaviour before committing, opening or merging a PR, publishing a release or handing off the work. A feature change is incomplete until its README documentation is current; a changelog or other documentation does not replace this requirement.
package/README.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # DanceMoves
2
2
 
3
+ **3.1.20** adds a shared playback transport for explicitly verified native and
4
+ YouTube players. Full-master players drive the existing musical effects; Shorts
5
+ map their offset and duration onto the master clock. See
6
+ [playback sources](docs/playback-sources.md) for provenance, controls and lifecycle.
7
+
8
+ **3.1.21** adds `publishPlayback()` and `receiveChildPlayback()` to connect an explicitly selected
9
+ child watch page to its parent runtime. The parent retains its existing cues,
10
+ lyrics and effect owners; closing or losing the child stops its clock. The
11
+ integration composes with the shared player API and requires its verified
12
+ master/excerpt mapping. See [child-page playback](docs/child-playback.md) and the
13
+ [standalone/modal example](examples/child-playback/README.md).
14
+
3
15
  `connectPhoneMotion()` attaches suitable existing spatial effects to one shared
4
16
  phone input route, preserving desktop pointer input. See the
5
17
  [connection guide](docs/phone-motion-connections.md) for permission UI, consumer
@@ -946,3 +958,12 @@ back into this section. Existing release and deployment history remains in Git,
946
958
  ## WordPress.org publication
947
959
 
948
960
  The release workflow can update the WordPress.org directory automatically after a validated release tag. Initial directory submission and human approval remain required. After approval, configure repository variables `WPORG_PLUGIN_APPROVED=true` and `WPORG_PLUGIN_SLUG` with the directory-assigned slug, plus `WPORG_SVN_USERNAME` and `WPORG_SVN_PASSWORD` secrets in the `wordpress-org` environment. The job verifies the exact tested release artifacts after the matching GitHub release exists, then uploads the packaged plugin through SVN. It remains disabled while the initial submission is queued; it does not install the plugin on a website. Website: https://kieransimkin.co.uk/danceflow/
961
+
962
+ ## Agent guidance releases
963
+
964
+ Source-only agent guidance releases use `readme-policy-vMAJOR.MINOR.PATCH` tags
965
+ and contain the updated instructions with a source manifest and checksums.
966
+ They version the documentation policy independently of the runtime packages.
967
+ The runtime release workflow accepts tags starting with `v` and then verifies
968
+ the exact semantic version and immutable source before building and publishing
969
+ packages. Guidance release events skip that workflow's build and publishing jobs.
@@ -0,0 +1,94 @@
1
+ # Playback from a child watch page
2
+
3
+ The parent EPK owns its timing metadata, master association and existing effect
4
+ controllers. A watch page owns its visible player. DanceMoves forwards the
5
+ child's actual playback state into the parent's shared player transport. It
6
+ does not forward cue labels, timing-file URLs, artwork or choreography.
7
+
8
+ ```js
9
+ // Parent: mount the runtime and its effects before opening the modal.
10
+ // Register after the selected master duration is known.
11
+ const child = motion.receiveChildPlayback({
12
+ iframe: document.querySelector('#watch-frame'),
13
+ origin: location.origin,
14
+ channel: 'watch-player',
15
+ assetId: 'verified-published-video-id',
16
+ master: document.querySelector('audio'),
17
+ masterVerified: true,
18
+ offset: 0, duration: 180
19
+ });
20
+ await child.ready;
21
+ // The existing motion.playbackSource(master) now follows the child.
22
+ // On modal close, dispose BEFORE removing the iframe:
23
+ child.teardown();
24
+ ```
25
+
26
+ ```js
27
+ // Child watch page: its real player is present on initial load.
28
+ // Standalone visits have no parent bridge or autoplay.
29
+ if (window.parent !== window) {
30
+ const publisher = motion.publishPlayback({
31
+ source: motion.playbackSource(master), // Native or registered YouTube transport.
32
+ targetWindow: window.parent,
33
+ origin: location.origin,
34
+ channel: 'watch-player',
35
+ assetId: 'verified-published-video-id'
36
+ });
37
+ // Dispose on route removal; runtime destruction also disposes the publisher.
38
+ }
39
+ ```
40
+
41
+ The scoped receiver requires the shared `registerPlaybackProvider`/`playbackSource` API.
42
+ Both low-level `createPlaybackReceiver()` and `createPlaybackPublisher()` are
43
+ exported for composition outside a mounted runtime. Their `window` option is an
44
+ explicit browser Window; module import is safe during SSR.
45
+
46
+ Supply an exact HTTP(S) origin including its port, never `*` or an opaque
47
+ origin. Source Window, channel, asset ID, a fresh receiver session, monotonic
48
+ sequence and finite bounded numeric state are checked on both sides. The asset
49
+ ID is a caller-selected identity, not runtime proof of soundtrack provenance.
50
+ Each frame has one receiver and each explicit route has one publisher until
51
+ teardown; reuse their transports for additional effect consumers.
52
+ Preserve verified published player IDs, render/source hashes and master mappings
53
+ outside the runtime. Do not bind unrelated edits using equal titles/durations.
54
+
55
+ Playback state includes position, duration, rate, pause, seek, buffering, end and
56
+ error. Position updates are coalesced to four per second; transport changes
57
+ remain immediate. The receiver interpolates between samples for
58
+ at most 500 ms and stops a playing source after 1500 ms without data. The
59
+ `staleAfterMilliseconds` option accepts 750–10000 ms. Native media events can
60
+ arrive sooner. No independent cue/beat parser or animation scheduler is added.
61
+ After a stale connection, call `reconnect()` to start a fresh session and await
62
+ its returned readiness promise; late packets from a disconnected session cannot
63
+ restart it. `ready` exposes the current connection attempt.
64
+
65
+ Parent pause and seek commands reach the child; parent play is rejected unless
66
+ the publisher explicitly enables `allowPlayCommands:true`. Browser autoplay
67
+ policies still apply and play-command rejection is observable through the
68
+ returned promise. Registering, reconnecting and receiving state never starts
69
+ media. Use real visitor controls and preserve consent flows before registering
70
+ a YouTube iframe. The parent does not play a muted duplicate soundtrack.
71
+
72
+ For Escape inside the child document, enable `notifyEscape:true` on the
73
+ publisher and subscribe to the receiver player's `dismiss` event to close the
74
+ dialog. Explicit child close buttons may call `publisher.requestClose()`.
75
+ Fullscreen retains its native Escape behaviour. Cross-origin nested players
76
+ may keep keyboard events in their own document; keep a visible parent close
77
+ control and test the actual embed's keyboard behaviour separately.
78
+
79
+ Frame load, visibility suspension and page restoration rotate the session.
80
+ Closing/removing the frame, pagehide, stale data and teardown stop the remote
81
+ clock; teardown also asks the child to pause and removes timers/listeners.
82
+ `ready` rejects after ten seconds without valid metadata or when removed before
83
+ readiness. Catch readiness failures and show accurate availability. A ready
84
+ bridge does not prove public playback or Google classification.
85
+
86
+ The parent source retains existing reduced-motion, forced-colour, quality,
87
+ visibility, cue/seek reconciliation and cleanup policies. The modal adapter owns
88
+ only dialog focus, ordinary controls, the iframe and lifecycle calls. Keep a
89
+ normal crawlable watch-page link and a player visible on the standalone page.
90
+ The browser fixture uses original synthetic media and tests cross-document
91
+ playback, seek, rate, preferences and removal; it is not physical Safari or
92
+ phone performance evidence.
93
+
94
+ Protocol design follows [Window.postMessage](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage).
@@ -0,0 +1,85 @@
1
+ # Audio, video and excerpt playback
2
+
3
+ One verified master can have several native audio/video and YouTube players.
4
+ `playbackSource(master)` returns a stable, event-driven transport. Existing
5
+ shared cues, lyrics, pulse, sprite, timeline and rudiment consumers resolve that
6
+ transport automatically when given its native master element. Page callbacks
7
+ that directly read a native element must instead read the returned transport.
8
+ The visible native controls keep controlling their original element.
9
+
10
+ Register each additional player explicitly, after its master duration is known:
11
+
12
+ ```js
13
+ const master = root.querySelector('audio');
14
+ const source = motion.playbackSource(master);
15
+ const full = motion.registerPlayer({master, player: root.querySelector('video'),
16
+ masterVerified: true});
17
+ const short = motion.registerYouTube({master,
18
+ iframe: root.querySelector('iframe'), masterVerified: true,
19
+ offset: 48, duration: 20});
20
+ await short.ready;
21
+ // Player time 3 seconds is master time 51 seconds.
22
+ // Dispose before removing/replacing the player:
23
+ short.teardown();
24
+ ```
25
+
26
+ A video-only page may pass one stable `{id, duration}` master reference instead
27
+ of a native element, using the verified recording identity and exact master
28
+ duration. This avoids adding or playing hidden audio. Reuse that reference for
29
+ all of the recording's players and pass `playbackSource(reference)` to its
30
+ effects. Registration joins the existing timing engine after runtime readiness.
31
+ WordPress still obtains its lyric/cue files exclusively from selected metadata.
32
+ If a native master is present but its metadata is still loading, include that
33
+ element as `element` in the reference. Its existing consumers keep the same
34
+ transport and the verified duration supplies the initial clock without waiting
35
+ for another media download. Conflicting or mismatched durations are rejected.
36
+
37
+ All values are seconds. `offset` is the start in the associated master,
38
+ `duration` is its contiguous excerpt length, and optional `playerStart` is the
39
+ point in the video where that soundtrack starts. Default offset/playerStart are
40
+ zero and default duration is the complete master. Negative, nonfinite, empty or
41
+ out-of-master windows are rejected. Preroll/postroll do not acquire a song clock.
42
+ This mapping describes a contiguous, unchanged-rate excerpt, not a mashup,
43
+ reordered edit or changed recording. Such media needs a separately verified
44
+ mapping and must not be falsely assigned to this master.
45
+
46
+ `masterVerified: true` is the caller's explicit provenance attestation. It is
47
+ never inferred from equal duration, similar titles or artwork. Preserve the
48
+ render/source hashes and exact published-player identity outside the runtime.
49
+ The top campaign video must use the exact release master as its soundtrack;
50
+ other full-master players share its clock, while distinct edits retain their
51
+ own identity. YouTube necessarily transcodes the upload: exactness here means
52
+ the supplied soundtrack and timing, not byte identity of YouTube's stream.
53
+
54
+ The first playing associated player pauses the prior associated player. It does
55
+ not secretly play muted duplicate audio. The source exposes master `currentTime`
56
+ and `duration`, actual playback state/rate, `activePlayer` and native `element`.
57
+ Mapped source seeks are clamped to the selected excerpt. Switching players
58
+ reconciles a seek without replaying skipped cues. Buffering pauses the source;
59
+ seek/rate/loop changes use the same existing effect lifecycle.
60
+ Preroll and postroll stay outside the song clock. Replaying an excerpt re-arms
61
+ its actual starting cue. Existing consumers of another associated native audio
62
+ element retain a stable source while the group keeps one cue dispatcher.
63
+
64
+ YouTube uses the official IFrame API, adds `enablejsapi=1` and the current origin,
65
+ and preserves an existing API-ready callback. Register after the visitor/consent
66
+ flow permits the iframe. Registration itself never requests autoplay. `ready`
67
+ rejects API/player failures or timeout. Always handle that promise and show an
68
+ accurate unavailable state. A successfully constructed player does not prove
69
+ playback or soundtrack identity. Test an advancing content timeline, controls,
70
+ pause, seek, rate, buffering, replay, visibility and teardown on real embeds.
71
+
72
+ Sampling runs only for the active, playing, visible YouTube source. Native
73
+ players use their events without a second scheduler. `teardown()` is idempotent;
74
+ runtime destruction releases registered owners. Shared effects retain their
75
+ reduced-motion, forced-colour, quality and visibility policies. Physical-device
76
+ performance still needs physical evidence.
77
+
78
+ Reference: [YouTube IFrame Player API](https://developers.google.com/youtube/iframe_api_reference).
79
+
80
+ `registerPlaybackProvider()` registers an explicit non-DOM, event-driven player
81
+ with the same verified master and excerpt mapping. It accepts the
82
+ media-compatible player produced by the [child-page receiver](child-playback.md).
83
+ Native DOM players retain `registerPlayer()` and its runtime-root checks.
84
+ Provider registrations share ownership, cue/lyric dispatch and teardown; no
85
+ additional timing engine or hidden media element is created.
@@ -7,6 +7,7 @@ physical tests were executed in a restricted development environment.
7
7
 
8
8
  | Feature | Shared entry/API | Demo/test coverage |
9
9
  |---|---|---|
10
+ | Child watch-page playback | `publishPlayback`, `receiveChildPlayback`, low-level receiver/publisher | Origin/session/state and lifecycle contracts; standalone/modal synthetic-media browser example |
10
11
  | BPM, ticks, duration quantization, boundaries | Main factory/core methods | Existing clock/scheduling/interval gallery; original core tests |
11
12
  | CSS timing/control/lyric disclosure | Core properties + CSS | WordPress-style clock/shared timing demos; original CSS contracts |
12
13
  | Named cues, intervals, DOM events, animation ownership | Core methods | React cue panel; original 23-page gallery and core contracts |
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": "dancemoves-library-build/v1",
3
3
  "name": "@kieransimkin/dancemoves",
4
- "version": "3.1.19",
4
+ "version": "3.1.21",
5
5
  "homepage": "https://kieransimkin.co.uk/my-songs/",
6
6
  "files": [
7
7
  {
@@ -31,23 +31,23 @@
31
31
  },
32
32
  {
33
33
  "path": "dancemoves.min.js",
34
- "bytes": 189980,
35
- "sha256": "2d9f8a6b5ac0ff32d6f940c31c16213e145c85c48fc9957ee2e405ce91d02d02"
34
+ "bytes": 212321,
35
+ "sha256": "540af619a286599f2340cb35f70294a70e6899d834b24d0c18a5cbd6b1d1c023"
36
36
  },
37
37
  {
38
38
  "path": "index.cjs",
39
- "bytes": 320229,
40
- "sha256": "df4670757481c736796dd9878148f33a2a7095713851f2d14218e6efeb4edd4a"
39
+ "bytes": 361185,
40
+ "sha256": "8c5b70cafdeb0135a8d4d4afd03a4a72064f71f75443bb253cace82de639bd1a"
41
41
  },
42
42
  {
43
43
  "path": "index.d.ts",
44
- "bytes": 10545,
45
- "sha256": "218096340a1ac20451ce28a04c31c74881a37ff3dad065decfcc8ac03d883143"
44
+ "bytes": 13718,
45
+ "sha256": "82ec16610754f0237cd91e2a7a7ce4f6fe17617d8a61b78d089143e9fdb142e4"
46
46
  },
47
47
  {
48
48
  "path": "index.mjs",
49
- "bytes": 319145,
50
- "sha256": "8cc48f64271c91392d8036ac4d361c08af310454b9a2132e80cd584858acb8da"
49
+ "bytes": 360040,
50
+ "sha256": "c23dfac191d589e317d65ec0c56beacf1f02129c1c78e37493a6d6c3a33dc6db"
51
51
  },
52
52
  {
53
53
  "path": "react.cjs",
@@ -66,8 +66,8 @@
66
66
  },
67
67
  {
68
68
  "path": "rudiments.d.ts",
69
- "bytes": 4579,
70
- "sha256": "cde62af2e915cd2c7dd7ea2356cf877886642b019223f4dcff0b6f7753cc24c1"
69
+ "bytes": 4900,
70
+ "sha256": "e7e534e3c78addfafe8b3994a7c4931b36b22f93d1587ef4eeea842cc4f03964"
71
71
  },
72
72
  {
73
73
  "path": "server.cjs",
@@ -106,8 +106,8 @@
106
106
  },
107
107
  {
108
108
  "path": "wordpress.js",
109
- "bytes": 188795,
110
- "sha256": "a759919bdc14b8850adc8a68a87445fa6341d629113c282834d798b27da97e9c"
109
+ "bytes": 211126,
110
+ "sha256": "f7c6f992c84282032e9a9b4257e2538c2424ee41aba07daf6a8957352c4f0f80"
111
111
  }
112
112
  ]
113
113
  }