@rntp/player 5.0.0-beta.2 → 5.0.0-beta.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.
- package/RNTPPlayer.podspec +1 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/TrackPlayerModule.kt +60 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/TrackPlayerPlaybackService.kt +156 -0
- package/android/src/main/java/com/doublesymmetry/trackplayer/models/BrowseTree.kt +51 -20
- package/android/src/main/java/com/doublesymmetry/trackplayer/models/EmitEventType.kt +11 -0
- package/ios/CarPlay/BrowseTreeStore.swift +40 -0
- package/ios/CarPlay/RNTPCarPlaySceneDelegate.swift +283 -0
- package/ios/TrackPlayer.swift +135 -1
- package/ios/TrackPlayerBridge.mm +9 -0
- package/ios/models/EmitEvent.swift +10 -0
- package/lib/commonjs/NativeTrackPlayer.js.map +1 -1
- package/lib/commonjs/audio.js +76 -7
- package/lib/commonjs/audio.js.map +1 -1
- package/lib/commonjs/events/SleepTimerTriggered.js +2 -0
- package/lib/commonjs/events/SleepTimerTriggered.js.map +1 -0
- package/lib/commonjs/events/index.js +13 -0
- package/lib/commonjs/events/index.js.map +1 -1
- package/lib/module/NativeTrackPlayer.js.map +1 -1
- package/lib/module/audio.js +72 -7
- package/lib/module/audio.js.map +1 -1
- package/lib/module/events/SleepTimerTriggered.js +2 -0
- package/lib/module/events/SleepTimerTriggered.js.map +1 -0
- package/lib/module/events/index.js +2 -0
- package/lib/module/events/index.js.map +1 -1
- package/lib/typescript/src/NativeTrackPlayer.d.ts +4 -0
- package/lib/typescript/src/NativeTrackPlayer.d.ts.map +1 -1
- package/lib/typescript/src/audio.d.ts +48 -5
- package/lib/typescript/src/audio.d.ts.map +1 -1
- package/lib/typescript/src/events/SleepTimerTriggered.d.ts +5 -0
- package/lib/typescript/src/events/SleepTimerTriggered.d.ts.map +1 -0
- package/lib/typescript/src/events/index.d.ts +5 -1
- package/lib/typescript/src/events/index.d.ts.map +1 -1
- package/lib/typescript/src/interfaces/BrowseTree.d.ts +35 -5
- package/lib/typescript/src/interfaces/BrowseTree.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeTrackPlayer.ts +6 -0
- package/src/audio.ts +84 -8
- package/src/events/SleepTimerTriggered.ts +4 -0
- package/src/events/index.ts +4 -0
- package/src/interfaces/BrowseTree.ts +40 -5
package/src/events/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
import type { PlaybackErrorEvent } from './PlaybackError';
|
|
21
21
|
import type { PlaybackProgressUpdatedEvent } from './PlaybackProgressUpdated';
|
|
22
22
|
import type { QueueChangedEvent } from './QueueChanged';
|
|
23
|
+
import type { SleepTimerTriggeredEvent } from './SleepTimerTriggered';
|
|
23
24
|
|
|
24
25
|
export enum Event {
|
|
25
26
|
PlaybackStateChanged = 'event.playback-state-changed',
|
|
@@ -37,6 +38,7 @@ export enum Event {
|
|
|
37
38
|
RemoteSeek = 'event.remote-seek',
|
|
38
39
|
RemoteSkipForward = 'event.remote-skip-forward',
|
|
39
40
|
RemoteSkipBackward = 'event.remote-skip-backward',
|
|
41
|
+
SleepTimerTriggered = 'event.sleep-timer-triggered',
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export type EventPayloadByEvent = {
|
|
@@ -55,6 +57,7 @@ export type EventPayloadByEvent = {
|
|
|
55
57
|
[Event.RemoteSeek]: RemoteSeekEvent;
|
|
56
58
|
[Event.RemoteSkipForward]: RemoteSkipForwardEvent;
|
|
57
59
|
[Event.RemoteSkipBackward]: RemoteSkipBackwardEvent;
|
|
60
|
+
[Event.SleepTimerTriggered]: SleepTimerTriggeredEvent;
|
|
58
61
|
};
|
|
59
62
|
|
|
60
63
|
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
@@ -77,3 +80,4 @@ export * from './RemoteControl';
|
|
|
77
80
|
export * from './PlaybackError';
|
|
78
81
|
export * from './PlaybackProgressUpdated';
|
|
79
82
|
export * from './QueueChanged';
|
|
83
|
+
export * from './SleepTimerTriggered';
|
|
@@ -3,17 +3,52 @@
|
|
|
3
3
|
* Commercial use requires a license. See https://rntp.dev/pricing
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { MediaUrl } from './MediaItem';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* An item in the browse tree — either a playable track or a browsable container.
|
|
10
|
+
*
|
|
11
|
+
* - `url` present → playable track (leaf node)
|
|
12
|
+
* - `children` present (no `url`) → browsable container (tapping drills down)
|
|
13
|
+
* - `url` takes precedence if both are present
|
|
14
|
+
*
|
|
15
|
+
* Maximum nesting depth: 4 levels (matching CarPlay's navigation stack limit).
|
|
16
|
+
*/
|
|
17
|
+
export interface BrowseItem {
|
|
18
|
+
/** Unique identifier for this item. */
|
|
19
|
+
mediaId: string;
|
|
20
|
+
/** Display title. */
|
|
21
|
+
title: string;
|
|
22
|
+
/** Artist or subtitle. */
|
|
23
|
+
artist?: string;
|
|
24
|
+
/** Artwork image URL. */
|
|
25
|
+
artworkUrl?: MediaUrl;
|
|
26
|
+
|
|
27
|
+
// Playable fields
|
|
28
|
+
/** Audio source URL. If present, this item is playable. */
|
|
29
|
+
url?: MediaUrl;
|
|
30
|
+
/** Duration hint in seconds. */
|
|
31
|
+
duration?: number;
|
|
32
|
+
/** Whether this is a live stream. */
|
|
33
|
+
isLive?: boolean;
|
|
34
|
+
/** MIME type hint for format detection. */
|
|
35
|
+
mimeType?: string;
|
|
36
|
+
|
|
37
|
+
// Browsable fields
|
|
38
|
+
/** Child items. If present (and no `url`), this item is browsable. */
|
|
39
|
+
children?: BrowseItem[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A top-level category in the browse tree.
|
|
44
|
+
* On Android Auto, each category is a browsable folder.
|
|
45
|
+
* On CarPlay, each category is a tab (max 4; overflow creates a "More" tab).
|
|
11
46
|
*/
|
|
12
47
|
export interface BrowseCategory {
|
|
13
48
|
/** Unique identifier for this category. */
|
|
14
49
|
mediaId: string;
|
|
15
50
|
/** Display title for the category (e.g. "Albums", "Podcasts"). */
|
|
16
51
|
title: string;
|
|
17
|
-
/**
|
|
18
|
-
items:
|
|
52
|
+
/** Items within this category — can be playable tracks or browsable containers. */
|
|
53
|
+
items: BrowseItem[];
|
|
19
54
|
}
|