@ldelia/react-media 0.4.6 → 0.4.7

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.
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { Reproduction } from './models/Reproduction';
3
3
  interface BaseProps {
4
4
  trainingMode: boolean;
5
+ songTempo?: number;
5
6
  onInit: (reproduction: Reproduction) => void;
6
7
  }
7
8
  interface TrainingProps extends BaseProps {
@@ -13,5 +14,5 @@ interface NonTrainingProps extends BaseProps {
13
14
  videoId?: never;
14
15
  }
15
16
  export type ReproductionWidgetProps = TrainingProps | NonTrainingProps;
16
- export declare const ReproductionWidget: ({ trainingMode, videoId, onInit, }: ReproductionWidgetProps) => React.JSX.Element;
17
+ export declare const ReproductionWidget: ({ trainingMode, videoId, songTempo, onInit, }: ReproductionWidgetProps) => React.JSX.Element;
17
18
  export {};
@@ -2,16 +2,14 @@ import React from 'react';
2
2
  import { YouTubeInnerPlayer } from './inner-players/YouTubeInnerPlayer';
3
3
  import { PlayAlongInnerPlayer } from './inner-players/PlayAlongInnerPlayer';
4
4
  import { Reproduction } from './models/Reproduction';
5
- export const ReproductionWidget = ({ trainingMode, videoId, onInit, }) => {
5
+ export const ReproductionWidget = ({ trainingMode, videoId, songTempo = 0, onInit, }) => {
6
6
  const DURATION_TO_TEST = 30;
7
- const TEMPO_TO_TEST = 90;
8
- const WITH_COUNTING_IN_TEST = true;
9
7
  function onPlayAlongInnerPlayerReadyHandler(event) {
10
8
  let newReproduction = Reproduction.newBuilder()
11
9
  .withTrainingMode(false)
12
10
  .withSongDuration(DURATION_TO_TEST)
13
- .withSongTempo(TEMPO_TO_TEST)
14
- .withCountingIn(WITH_COUNTING_IN_TEST)
11
+ .withSongTempo(songTempo)
12
+ .withCountingIn(songTempo > 0)
15
13
  .withInnerPlayer(event.target)
16
14
  .createReproduction();
17
15
  onInit(newReproduction);
@@ -19,8 +17,8 @@ export const ReproductionWidget = ({ trainingMode, videoId, onInit, }) => {
19
17
  function onYouTubeInnerPlayerReadyHandler(event) {
20
18
  let newReproduction = Reproduction.newBuilder()
21
19
  .withTrainingMode(true)
22
- .withSongTempo(TEMPO_TO_TEST)
23
- .withCountingIn(WITH_COUNTING_IN_TEST)
20
+ .withSongTempo(songTempo)
21
+ .withCountingIn(songTempo > 0)
24
22
  .withInnerPlayer(event.target)
25
23
  .createReproduction();
26
24
  onInit(newReproduction);
@@ -12,6 +12,7 @@ export const Default = Template.bind({});
12
12
  Default.args = {
13
13
  trainingMode: true,
14
14
  videoId: 'jFI-RBqXzhU',
15
+ songTempo: 180,
15
16
  onInit: (reproduction) => {
16
17
  console.log("on init");
17
18
  reproduction.on('COUNTING_IN', (args) => { console.log("counting in", args); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldelia/react-media",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "A React components collection for media-related features.",
5
5
  "private": false,
6
6
  "keywords": [