natively 2.28.3 → 2.28.4

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.
@@ -21,10 +21,19 @@ type AudioQueueAddOptions = AudioMetadata & {
21
21
  is_stream?: boolean;
22
22
  headers?: Record<string, string>;
23
23
  };
24
+ type AudioSampleMode = "duck" | "stop" | "mix";
25
+ type AudioSampleOptions = {
26
+ headers?: Record<string, string>;
27
+ start_position?: number;
28
+ sample_duration?: number;
29
+ volume?: number;
30
+ speed?: number;
31
+ };
24
32
  export declare class NativelyAudioPlayer {
25
33
  private readonly id;
26
34
  private buildMetadata;
27
35
  play(source: string, options?: AudioPlayOptions, play_callback?: Function): void;
36
+ playSample(url: string, mode: AudioSampleMode, play_sample_callback?: Function, options?: AudioSampleOptions): void;
28
37
  pause(pause_callback?: Function): void;
29
38
  stop(stop_callback?: Function): void;
30
39
  seek(position: number, seek_callback?: Function): void;
@@ -37,6 +37,18 @@ export class NativelyAudioPlayer {
37
37
  if ((options === null || options === void 0 ? void 0 : options.speed) != null) params.speed = options.speed;
38
38
  globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, play_callback, "audio_play", params);
39
39
  }
40
+ playSample(url, mode, play_sample_callback, options) {
41
+ var params = {
42
+ url,
43
+ mode
44
+ };
45
+ if ((options === null || options === void 0 ? void 0 : options.headers) !== undefined) params.headers = options.headers;
46
+ if ((options === null || options === void 0 ? void 0 : options.start_position) != null) params.start_position = options.start_position;
47
+ if ((options === null || options === void 0 ? void 0 : options.sample_duration) != null) params.sample_duration = options.sample_duration;
48
+ if ((options === null || options === void 0 ? void 0 : options.volume) != null) params.volume = options.volume;
49
+ if ((options === null || options === void 0 ? void 0 : options.speed) != null) params.speed = options.speed;
50
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, play_sample_callback, "audio_play_sample", params);
51
+ }
40
52
  pause(pause_callback) {
41
53
  globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, pause_callback, "audio_pause", {});
42
54
  }
@@ -80,4 +92,4 @@ export class NativelyAudioPlayer {
80
92
  speed
81
93
  });
82
94
  }
83
- }
95
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natively",
3
- "version": "2.28.3",
3
+ "version": "2.28.4",
4
4
  "description": "Natively SDK for building native-like web applications",
5
5
  "type": "module",
6
6
  "exports": {