expo-gliph-player 1.3.14 → 1.3.15

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.
@@ -148,33 +148,40 @@ class GliphPlayerModule(
148
148
  }
149
149
  }
150
150
 
151
- @ReactMethod
152
- override fun skip(index: Double, initialPosition: Double, promise: Promise) {
153
- scope.launch {
154
- try {
155
- playerService?.skip(index.toInt(), if (initialPosition < 0) -1.0 else initialPosition)
156
- promise.resolve(null)
157
- } catch (e: Exception) { promise.reject("skip_error", e.message, e) }
151
+ @ReactMethod
152
+ override fun skip(index: Double, initialPosition: Double, autoPlay: Boolean, promise: Promise) {
153
+ scope.launch {
154
+ try {
155
+ val pos = if (initialPosition < 0) -1.0 else initialPosition
156
+ playerService?.skip(index.toInt(), pos, autoPlay)
157
+ promise.resolve(null)
158
+ } catch (e: Exception) {
159
+ promise.reject("skip_error", e.message, e)
160
+ }
161
+ }
158
162
  }
159
- }
160
163
 
161
164
  @ReactMethod
162
- override fun skipToNext(initialPosition: Double, promise: Promise) {
165
+ override fun skipToNext(initialPosition: Double, autoPlay: Boolean, promise: Promise) {
163
166
  scope.launch {
164
167
  try {
165
- playerService?.skipToNext(if (initialPosition < 0) -1.0 else initialPosition)
168
+ playerService?.skipToNext(if (initialPosition < 0) -1.0 else initialPosition, autoPlay)
166
169
  promise.resolve(null)
167
- } catch (e: Exception) { promise.reject("skip_error", e.message, e) }
170
+ } catch (e: Exception) {
171
+ promise.reject("skip_error", e.message, e)
172
+ }
168
173
  }
169
174
  }
170
175
 
171
176
  @ReactMethod
172
- override fun skipToPrevious(initialPosition: Double, promise: Promise) {
177
+ override fun skipToPrevious(initialPosition: Double, autoPlay: Boolean, promise: Promise) {
173
178
  scope.launch {
174
179
  try {
175
- playerService?.skipToPrevious(if (initialPosition < 0) -1.0 else initialPosition)
180
+ playerService?.skipToPrevious(if (initialPosition < 0) -1.0 else initialPosition, autoPlay)
176
181
  promise.resolve(null)
177
- } catch (e: Exception) { promise.reject("skip_error", e.message, e) }
182
+ } catch (e: Exception) {
183
+ promise.reject("skip_error", e.message, e)
184
+ }
178
185
  }
179
186
  }
180
187
 
@@ -357,4 +364,4 @@ class GliphPlayerModule(
357
364
  }
358
365
 
359
366
  override fun getName() = NAME
360
- }
367
+ }
@@ -12,6 +12,7 @@ import android.os.IBinder
12
12
  import androidx.media3.common.*
13
13
  import androidx.media3.common.util.UnstableApi
14
14
  import androidx.media3.exoplayer.ExoPlayer
15
+ import androidx.media3.exoplayer.DefaultLoadControl
15
16
  import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
16
17
  import androidx.media3.session.*
17
18
  import androidx.core.app.NotificationCompat
@@ -127,8 +128,8 @@ class GliphPlayerService : MediaLibraryService() {
127
128
  when (intent?.action) {
128
129
  ACTION_PLAY -> play()
129
130
  ACTION_PAUSE -> pause()
130
- ACTION_SKIP_NEXT -> skipToNext(-1.0)
131
- ACTION_SKIP_PREVIOUS -> skipToPrevious(-1.0)
131
+ ACTION_SKIP_NEXT -> skipToNext(-1.0, true)
132
+ ACTION_SKIP_PREVIOUS -> skipToPrevious(-1.0, true)
132
133
  ACTION_STOP -> {
133
134
  stop()
134
135
  stopSelf()
@@ -163,29 +164,39 @@ class GliphPlayerService : MediaLibraryService() {
163
164
  // ── Init ────────────────────────────────────────────────────────────────────
164
165
 
165
166
  private fun initPlayer(opts: ReadableMap? = null) {
166
- val minBufferMs = (getDouble(opts, "minBuffer", 15.0) * 1000).toInt()
167
- val maxBufferMs = (getDouble(opts, "maxBuffer", 50.0) * 1000).toInt()
168
- val playBufferMs = (getDouble(opts, "playBuffer", 2.5) * 1000).toInt()
169
- val backBufferMs = (getDouble(opts, "backBuffer", 0.0) * 1000).toInt()
170
-
171
- val loadControl = androidx.media3.exoplayer.DefaultLoadControl.Builder()
172
- .setBufferDurationsMs(minBufferMs, maxBufferMs, playBufferMs, playBufferMs)
173
- .setBackBuffer(backBufferMs, /* retainBackBufferFromKeyframe= */ false)
174
- .build()
167
+ val playBufferSec = getDouble(opts, "playBuffer", 2.5)
168
+ val minBufferSec = getDouble(opts, "minBuffer", 15.0)
169
+ val maxBufferSec = getDouble(opts, "maxBuffer", 50.0)
170
+ val backBufferSec = getDouble(opts, "backBuffer", 0.0)
171
+
172
+ val playBufferMs = (playBufferSec * 1000).toInt() // 2500ms
173
+ var minBufferMs = (minBufferSec * 1000).toInt() // 15000ms
174
+ val maxBufferMs = (maxBufferSec * 1000).toInt() // 50000ms
175
+ val backBufferMs = (backBufferSec * 1000).toInt() // 0ms
176
+
177
+ if (minBufferMs < playBufferMs) {
178
+ Log.w("GliphPlayer", "minBufferMs ($minBufferMs) < playBufferMs ($playBufferMs), adjusting...")
179
+ minBufferMs = playBufferMs
180
+ }
181
+
182
+ val loadControl = DefaultLoadControl.Builder()
183
+ .setBufferDurationsMs(minBufferMs, maxBufferMs, playBufferMs, playBufferMs)
184
+ .setBackBuffer(backBufferMs, false)
185
+ .build()
175
186
 
176
187
  player = ExoPlayer.Builder(this)
177
- .setMediaSourceFactory(DefaultMediaSourceFactory(this))
178
- .setLoadControl(loadControl)
179
- .setHandleAudioBecomingNoisy(true)
180
- .setWakeMode(C.WAKE_MODE_NETWORK)
181
- .setAudioAttributes(
182
- AudioAttributes.Builder()
183
- .setUsage(C.USAGE_MEDIA)
184
- .setContentType(C.AUDIO_CONTENT_TYPE_MUSIC)
185
- .build(),
186
- /* handleAudioFocus= */ true
187
- )
188
- .build()
188
+ .setMediaSourceFactory(DefaultMediaSourceFactory(this))
189
+ .setLoadControl(loadControl)
190
+ .setHandleAudioBecomingNoisy(true)
191
+ .setWakeMode(C.WAKE_MODE_NETWORK)
192
+ .setAudioAttributes(
193
+ AudioAttributes.Builder()
194
+ .setUsage(C.USAGE_MEDIA)
195
+ .setContentType(C.AUDIO_CONTENT_TYPE_MUSIC)
196
+ .build(),
197
+ true
198
+ )
199
+ .build()
189
200
 
190
201
  player.addListener(playerListener)
191
202
 
@@ -384,7 +395,7 @@ class GliphPlayerService : MediaLibraryService() {
384
395
  insertBeforeIndex
385
396
  }
386
397
 
387
- val wasEmpty = queue.isEmpty() // ✅ Сохраняем состояние ДО добавления
398
+ val wasEmpty = queue.isEmpty()
388
399
  val mediaItems = mutableListOf<MediaItem>()
389
400
 
390
401
  for (i in 0 until tracks.size()) {
@@ -400,7 +411,6 @@ class GliphPlayerService : MediaLibraryService() {
400
411
  player.addMediaItems(insertBeforeIndex, mediaItems)
401
412
  }
402
413
 
403
- // ✅ Если очередь была пуста - отправляем событие
404
414
  if (wasEmpty && queue.isNotEmpty()) {
405
415
  emitActiveTrackChanged()
406
416
  }
@@ -432,42 +442,57 @@ class GliphPlayerService : MediaLibraryService() {
432
442
  }
433
443
  }
434
444
 
435
- // ✅ ИСПРАВЛЕНО: Добавлено событие
436
- fun skip(index: Int, initialPosition: Double) {
437
- val lastIndex = player.currentMediaItemIndex
438
- player.seekTo(index, if (initialPosition >= 0) (initialPosition * 1000).toLong() else C.TIME_UNSET)
439
- player.play()
445
+ fun skip(index: Int, initialPosition: Double, autoPlay: Boolean = true) {
446
+ val lastIndex = player.currentMediaItemIndex
440
447
 
441
- // ✅ Отправляем событие
442
- emitActiveTrackChanged(lastIndex)
443
- emitPlaybackState("playing")
444
- }
448
+ if (index < 0 || index >= queue.size) {
449
+ Log.e("GliphPlayer", "skip: index $index out of bounds")
450
+ return
451
+ }
445
452
 
446
- // ✅ ИСПРАВЛЕНО: Добавлено событие
447
- fun skipToNext(initialPosition: Double) {
453
+ player.seekTo(index, if (initialPosition >= 0) (initialPosition * 1000).toLong() else C.TIME_UNSET)
454
+
455
+ if (autoPlay) {
456
+ player.playWhenReady = true
457
+
458
+ if (player.playbackState == Player.STATE_IDLE) {
459
+ player.prepare()
460
+ }
461
+
462
+ player.play()
463
+ emitPlaybackState("playing")
464
+ }
465
+
466
+ emitActiveTrackChanged(lastIndex)
467
+ }
468
+
469
+ fun skipToNext(initialPosition: Double, autoPlay: Boolean = true) {
448
470
  if (player.hasNextMediaItem()) {
449
471
  val lastIndex = player.currentMediaItemIndex
450
472
  player.seekToNextMediaItem()
451
473
  if (initialPosition >= 0) player.seekTo((initialPosition * 1000).toLong())
452
- player.play()
453
474
 
454
- // ✅ Отправляем событие
475
+ if (autoPlay) {
476
+ player.play()
477
+ }
478
+
455
479
  emitActiveTrackChanged(lastIndex)
456
- emitPlaybackState("playing")
480
+ emitPlaybackState(if (autoPlay) "playing" else "paused")
457
481
  }
458
482
  }
459
483
 
460
- // ✅ ИСПРАВЛЕНО: Добавлено событие
461
- fun skipToPrevious(initialPosition: Double) {
484
+ fun skipToPrevious(initialPosition: Double, autoPlay: Boolean = true) {
462
485
  if (player.hasPreviousMediaItem()) {
463
486
  val lastIndex = player.currentMediaItemIndex
464
487
  player.seekToPreviousMediaItem()
465
488
  if (initialPosition >= 0) player.seekTo((initialPosition * 1000).toLong())
466
- player.play()
467
489
 
468
- // ✅ Отправляем событие
490
+ if (autoPlay) {
491
+ player.play()
492
+ }
493
+
469
494
  emitActiveTrackChanged(lastIndex)
470
- emitPlaybackState("playing")
495
+ emitPlaybackState(if (autoPlay) "playing" else "paused")
471
496
  }
472
497
  }
473
498
 
@@ -480,17 +505,14 @@ class GliphPlayerService : MediaLibraryService() {
480
505
 
481
506
  // ── Playback control ────────────────────────────────────────────────────────
482
507
 
483
- // ✅ ИСПРАВЛЕНО: Добавлены события
484
508
  fun play() {
485
509
  if (player.playbackState == Player.STATE_IDLE) {
486
510
  player.prepare()
487
511
  }
488
512
  player.play()
489
513
 
490
- // ✅ Отправляем состояние
491
514
  emitPlaybackState("playing")
492
515
 
493
- // ✅ Если есть активный трек - отправляем его
494
516
  if (player.currentMediaItemIndex >= 0 && player.currentMediaItemIndex < queue.size) {
495
517
  emitActiveTrackChanged()
496
518
  }
@@ -498,34 +520,28 @@ class GliphPlayerService : MediaLibraryService() {
498
520
  updateMediaNotification()
499
521
  }
500
522
 
501
- // ✅ ИСПРАВЛЕНО: Добавлено событие
502
523
  fun pause() {
503
524
  player.pause()
504
525
 
505
- // ✅ Отправляем состояние
506
526
  emitPlaybackState("paused")
507
527
 
508
528
  updateMediaNotification()
509
529
  }
510
530
 
511
- // ✅ ИСПРАВЛЕНО: Добавлено событие
512
531
  fun stop() {
513
532
  player.stop()
514
533
 
515
- // ✅ Отправляем состояние
516
534
  emitPlaybackState("stopped")
517
535
 
518
536
  updateMediaNotification()
519
537
  }
520
538
 
521
- // ✅ ИСПРАВЛЕНО: Добавлены события
522
539
  fun reset() {
523
540
  val lastIndex = player.currentMediaItemIndex
524
541
  player.stop()
525
542
  player.clearMediaItems()
526
543
  queue.clear()
527
544
 
528
- // ✅ Отправляем событие об очистке
529
545
  val map = Arguments.createMap()
530
546
  map.putInt("index", -1)
531
547
  map.putNull("track")
@@ -766,12 +782,10 @@ class GliphPlayerService : MediaLibraryService() {
766
782
  updateMediaNotification()
767
783
 
768
784
  if (playbackState == Player.STATE_ENDED) {
769
- // ✅ Отправляем track-ended
770
785
  val map = Arguments.createMap()
771
786
  map.putInt("index", player.currentMediaItemIndex)
772
787
  eventEmitter?.invoke("playback-track-ended", map)
773
788
 
774
- // ✅ Отправляем queue-ended
775
789
  val queueMap = Arguments.createMap()
776
790
  queueMap.putInt("index", player.currentMediaItemIndex)
777
791
  queueMap.putDouble("position", player.currentPosition / 1000.0)
@@ -785,7 +799,6 @@ class GliphPlayerService : MediaLibraryService() {
785
799
  }
786
800
 
787
801
  override fun onMediaItemTransition(mediaItem: MediaItem?, reason: Int) {
788
- // ✅ Отправляем track-ended для предыдущего трека
789
802
  if (reason == Player.MEDIA_ITEM_TRANSITION_REASON_AUTO ||
790
803
  reason == Player.MEDIA_ITEM_TRANSITION_REASON_REPEAT) {
791
804
  val endedMap = Arguments.createMap()
@@ -811,7 +824,6 @@ class GliphPlayerService : MediaLibraryService() {
811
824
  map.putNull("lastTrack")
812
825
  }
813
826
 
814
- // ✅ Отправляем active-track-changed
815
827
  eventEmitter?.invoke("playback-active-track-changed", map)
816
828
  lastIndex = newIndex
817
829
  updateMediaNotification()
@@ -162,6 +162,7 @@ public typealias RCTPromiseRejectBlock = (String?, String?, Error?) -> Void
162
162
  @objc public func skipToIndex(
163
163
  _ index: Int,
164
164
  initialPosition: Double,
165
+ autoPlay: Bool = true,
165
166
  resolve: @escaping RCTPromiseResolveBlock,
166
167
  reject: @escaping RCTPromiseRejectBlock
167
168
  ) {
@@ -176,7 +177,10 @@ public typealias RCTPromiseRejectBlock = (String?, String?, Error?) -> Void
176
177
  if initialPosition >= 0 {
177
178
  player?.seek(to: CMTime(seconds: initialPosition, preferredTimescale: 1000))
178
179
  }
179
- player?.play()
180
+
181
+ if autoPlay {
182
+ player?.play()
183
+ }
180
184
 
181
185
  emitActiveTrackChanged(lastIndex: lastIndex)
182
186
 
@@ -185,6 +189,7 @@ public typealias RCTPromiseRejectBlock = (String?, String?, Error?) -> Void
185
189
 
186
190
  @objc public func skipToNext(
187
191
  initialPosition: Double,
192
+ autoPlay: Bool = true,
188
193
  resolve: @escaping RCTPromiseResolveBlock,
189
194
  reject: @escaping RCTPromiseRejectBlock
190
195
  ) {
@@ -192,11 +197,12 @@ public typealias RCTPromiseRejectBlock = (String?, String?, Error?) -> Void
192
197
  guard next < queue.count else {
193
198
  reject("skip_error", "No next track", nil); return
194
199
  }
195
- skipToIndex(next, initialPosition: initialPosition, resolve: resolve, reject: reject)
200
+ skipToIndex(next, initialPosition: initialPosition, autoPlay: autoPlay, resolve: resolve, reject: reject)
196
201
  }
197
202
 
198
203
  @objc public func skipToPrevious(
199
204
  initialPosition: Double,
205
+ autoPlay: Bool = true,
200
206
  resolve: @escaping RCTPromiseResolveBlock,
201
207
  reject: @escaping RCTPromiseRejectBlock
202
208
  ) {
@@ -204,7 +210,7 @@ public typealias RCTPromiseRejectBlock = (String?, String?, Error?) -> Void
204
210
  guard prev >= 0 else {
205
211
  reject("skip_error", "No previous track", nil); return
206
212
  }
207
- skipToIndex(prev, initialPosition: initialPosition, resolve: resolve, reject: reject)
213
+ skipToIndex(prev, initialPosition: initialPosition, autoPlay: autoPlay, resolve: resolve, reject: reject)
208
214
  }
209
215
 
210
216
  @objc public func moveFrom(
@@ -528,7 +534,7 @@ public typealias RCTPromiseRejectBlock = (String?, String?, Error?) -> Void
528
534
  guard let self = self else { return .commandFailed }
529
535
  let next = self.currentIndex + 1
530
536
  if next < self.queue.count {
531
- self.skipToIndex(next, initialPosition: -1, resolve: { _ in }, reject: { _, _, _ in })
537
+ self.skipToIndex(next, initialPosition: -1, autoPlay: true, resolve: { _ in }, reject: { _, _, _ in })
532
538
  }
533
539
  self.eventEmitter("remote-next", nil)
534
540
  return .success
@@ -540,7 +546,7 @@ public typealias RCTPromiseRejectBlock = (String?, String?, Error?) -> Void
540
546
  guard let self = self else { return .commandFailed }
541
547
  let prev = self.currentIndex - 1
542
548
  if prev >= 0 {
543
- self.skipToIndex(prev, initialPosition: -1, resolve: { _ in }, reject: { _, _, _ in })
549
+ self.skipToIndex(prev, initialPosition: -1, autoPlay: true, resolve: { _ in }, reject: { _, _, _ in })
544
550
  }
545
551
  self.eventEmitter("remote-previous", nil)
546
552
  return .success
@@ -633,7 +639,6 @@ public typealias RCTPromiseRejectBlock = (String?, String?, Error?) -> Void
633
639
  let nextIndex = currentIndex + 1
634
640
  let currentPosition = CMTimeGetSeconds(player?.currentTime() ?? .zero)
635
641
 
636
- // ✅ 1. Отправляем событие окончания ТЕКУЩЕГО трека
637
642
  eventEmitter("playback-track-ended", [
638
643
  "index": currentIndex,
639
644
  "position": currentPosition
@@ -96,21 +96,34 @@ RCT_EXPORT_METHOD(removeUpcomingTracks:(RCTPromiseResolveBlock)resolve
96
96
 
97
97
  RCT_EXPORT_METHOD(skip:(double)index
98
98
  initialPosition:(double)initialPosition
99
+ autoPlay:(BOOL)autoPlay
99
100
  resolve:(RCTPromiseResolveBlock)resolve
100
101
  reject:(RCTPromiseRejectBlock)reject) {
101
- [_player skipToIndex:(NSInteger)index initialPosition:initialPosition resolve:resolve reject:reject];
102
+ [_player skipToIndex:(NSInteger)index
103
+ initialPosition:initialPosition
104
+ autoPlay:autoPlay
105
+ resolve:resolve
106
+ reject:reject];
102
107
  }
103
108
 
104
109
  RCT_EXPORT_METHOD(skipToNext:(double)initialPosition
110
+ autoPlay:(BOOL)autoPlay
105
111
  resolve:(RCTPromiseResolveBlock)resolve
106
112
  reject:(RCTPromiseRejectBlock)reject) {
107
- [_player skipToNextWithInitialPosition:initialPosition resolve:resolve reject:reject];
113
+ [_player skipToNextWithInitialPosition:initialPosition
114
+ autoPlay:autoPlay
115
+ resolve:resolve
116
+ reject:reject];
108
117
  }
109
118
 
110
119
  RCT_EXPORT_METHOD(skipToPrevious:(double)initialPosition
120
+ autoPlay:(BOOL)autoPlay
111
121
  resolve:(RCTPromiseResolveBlock)resolve
112
122
  reject:(RCTPromiseRejectBlock)reject) {
113
- [_player skipToPreviousWithInitialPosition:initialPosition resolve:resolve reject:reject];
123
+ [_player skipToPreviousWithInitialPosition:initialPosition
124
+ autoPlay:autoPlay
125
+ resolve:resolve
126
+ reject:reject];
114
127
  }
115
128
 
116
129
  RCT_EXPORT_METHOD(move:(double)fromIndex
@@ -6,20 +6,24 @@
6
6
  */
7
7
  import type { Track, PlayerOptions, UpdateOptions, Progress, PlaybackState } from './types';
8
8
  import { RepeatMode, State } from './types';
9
+
9
10
  declare const GliphPlayer: {
10
11
  /**
11
12
  * Initialize the player. Must be called once before any other method.
12
13
  * Safe to call multiple times — subsequent calls are no-ops.
13
14
  */
14
15
  setupPlayer(options?: PlayerOptions): Promise<void>;
16
+
15
17
  /**
16
18
  * Destroy the player and release all resources.
17
19
  */
18
20
  destroy(): void;
21
+
19
22
  /**
20
23
  * Returns true if the background service is running (Android).
21
24
  */
22
25
  isServiceRunning(): Promise<boolean>;
26
+
23
27
  /**
24
28
  * Add one or more tracks to the queue.
25
29
  * @param tracks Single track or array of tracks.
@@ -27,71 +31,96 @@ declare const GliphPlayer: {
27
31
  * @returns The index of the first inserted track.
28
32
  */
29
33
  add(tracks: Track | Track[], insertBeforeIndex?: number): Promise<number | void>;
34
+
30
35
  /**
31
36
  * Remove tracks by their IDs.
32
37
  */
33
38
  remove(trackIds: string | string[]): Promise<void>;
39
+
34
40
  /**
35
41
  * Remove all tracks after the current one.
36
42
  */
37
43
  removeUpcomingTracks(): Promise<void>;
44
+
38
45
  /**
39
46
  * Skip to a specific queue index.
47
+ * @param index - Index of the track to skip to
48
+ * @param initialPosition - Position in seconds to start from (default: -1 = start)
49
+ * @param autoPlay - Whether to automatically start playback (default: true)
40
50
  */
41
- skip(index: number, initialPosition?: number): Promise<void>;
51
+ skip(index: number, initialPosition?: number, autoPlay?: boolean): Promise<void>;
52
+
42
53
  /**
43
54
  * Skip to the next track.
55
+ * @param initialPosition - Position in seconds to start from (default: -1 = start)
56
+ * @param autoPlay - Whether to automatically start playback (default: true)
44
57
  */
45
- skipToNext(initialPosition?: number): Promise<void>;
58
+ skipToNext(initialPosition?: number, autoPlay?: boolean): Promise<void>;
59
+
46
60
  /**
47
61
  * Skip to the previous track.
62
+ * @param initialPosition - Position in seconds to start from (default: -1 = start)
63
+ * @param autoPlay - Whether to automatically start playback (default: true)
48
64
  */
49
- skipToPrevious(initialPosition?: number): Promise<void>;
65
+ skipToPrevious(initialPosition?: number, autoPlay?: boolean): Promise<void>;
66
+
50
67
  /**
51
68
  * Move a track from one index to another.
52
69
  */
53
70
  move(fromIndex: number, toIndex: number): Promise<void>;
71
+
54
72
  play(): Promise<void>;
55
73
  pause(): Promise<void>;
56
74
  stop(): Promise<void>;
75
+
57
76
  /**
58
77
  * Stop playback and clear the queue.
59
78
  */
60
79
  reset(): Promise<void>;
80
+
61
81
  /**
62
82
  * Seek to an absolute position in seconds.
63
83
  */
64
84
  seekTo(position: number): Promise<void>;
85
+
65
86
  /**
66
87
  * Seek by a relative offset in seconds (positive = forward, negative = back).
67
88
  */
68
89
  seekBy(offset: number): Promise<void>;
90
+
69
91
  /**
70
92
  * Set volume (0.0 – 1.0).
71
93
  */
72
94
  setVolume(volume: number): Promise<void>;
73
95
  getVolume(): Promise<number>;
96
+
74
97
  /**
75
98
  * Set playback rate (1.0 = normal speed).
76
99
  */
77
100
  setRate(rate: number): Promise<void>;
78
101
  getRate(): Promise<number>;
102
+
79
103
  setRepeatMode(mode: RepeatMode): Promise<void>;
80
104
  getRepeatMode(): Promise<RepeatMode>;
105
+
81
106
  getQueue(): Promise<Track[]>;
82
107
  getActiveTrackIndex(): Promise<number | null>;
83
108
  getActiveTrack(): Promise<Track | null>;
84
109
  getTrack(index: number): Promise<Track | null>;
85
110
  getQueueSize(): Promise<number>;
111
+
86
112
  getPlaybackState(): Promise<PlaybackState>;
87
113
  getProgress(): Promise<Progress>;
114
+
88
115
  updateMetadataForTrack(index: number, metadata: Partial<Track>): Promise<void>;
89
116
  clearNowPlayingMetadata(): Promise<void>;
90
117
  updateNowPlayingMetadata(metadata: Partial<Track>): Promise<void>;
118
+
91
119
  /**
92
120
  * Configure notification capabilities, jump intervals, etc.
93
121
  */
94
122
  updateOptions(options: UpdateOptions): Promise<void>;
123
+
95
124
  /**
96
125
  * Subscribe to a player event.
97
126
  * Returns an unsubscribe function — call it to remove the listener.
@@ -105,9 +134,10 @@ declare const GliphPlayer: {
105
134
  */
106
135
  addEventListener<E extends string>(event: E, listener: (data: any) => void): () => void;
107
136
  };
137
+
108
138
  export default GliphPlayer;
139
+
109
140
  export declare function isPlaying(state: State): boolean;
110
141
  export declare function isPaused(state: State): boolean;
111
142
  export declare function isBuffering(state: State): boolean;
112
- export declare function isStopped(state: State): boolean;
113
- //# sourceMappingURL=GliphPlayer.d.ts.map
143
+ export declare function isStopped(state: State): boolean;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Aleksey Ostrikov",
5
5
  "email": "alex303606@gmail.com"
6
6
  },
7
- "version": "1.3.14",
7
+ "version": "1.3.15",
8
8
  "description": "Fixed version of react-native-gliph-player with Expo compatibility",
9
9
  "main": "app.plugin.js",
10
10
  "module": "lib/module/index.js",