capacitor-plugin-playlist 0.6.2 → 0.7.0

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/dist/docs.json CHANGED
@@ -12,12 +12,12 @@
12
12
  {
13
13
  "name": "eventName",
14
14
  "docs": "",
15
- "type": "\"status\""
15
+ "type": "'status'"
16
16
  },
17
17
  {
18
18
  "name": "listenerFunc",
19
19
  "docs": "",
20
- "type": "(data: PlaylistStatusChangeCallbackArg) => void"
20
+ "type": "PlaylistStatusChangeCallback"
21
21
  }
22
22
  ],
23
23
  "returns": "Promise<PluginListenerHandle>",
@@ -27,7 +27,7 @@
27
27
  "PluginListenerHandle",
28
28
  "PlaylistStatusChangeCallback"
29
29
  ],
30
- "slug": "addlistener"
30
+ "slug": "addlistenerstatus-"
31
31
  },
32
32
  {
33
33
  "name": "setOptions",
@@ -371,6 +371,282 @@
371
371
  }
372
372
  ]
373
373
  },
374
+ {
375
+ "name": "PlaylistStatusChangeCallbackArg",
376
+ "slug": "playliststatuschangecallbackarg",
377
+ "docs": "",
378
+ "tags": [],
379
+ "methods": [],
380
+ "properties": [
381
+ {
382
+ "name": "action",
383
+ "tags": [],
384
+ "docs": "",
385
+ "complexTypes": [],
386
+ "type": "string"
387
+ },
388
+ {
389
+ "name": "status",
390
+ "tags": [],
391
+ "docs": "",
392
+ "complexTypes": [
393
+ "OnStatusCallbackData"
394
+ ],
395
+ "type": "OnStatusCallbackData"
396
+ }
397
+ ]
398
+ },
399
+ {
400
+ "name": "OnStatusCallbackData",
401
+ "slug": "onstatuscallbackdata",
402
+ "docs": "Encapsulates the data received by an onStatus callback",
403
+ "tags": [],
404
+ "methods": [],
405
+ "properties": [
406
+ {
407
+ "name": "trackId",
408
+ "tags": [],
409
+ "docs": "The ID of this track. If the track is null or has completed, this value is \"NONE\"\nIf the playlist is completed, this value is \"INVALID\"",
410
+ "complexTypes": [],
411
+ "type": "string"
412
+ },
413
+ {
414
+ "name": "msgType",
415
+ "tags": [],
416
+ "docs": "The type of status update",
417
+ "complexTypes": [
418
+ "RmxAudioStatusMessage"
419
+ ],
420
+ "type": "RmxAudioStatusMessage"
421
+ },
422
+ {
423
+ "name": "value",
424
+ "tags": [],
425
+ "docs": "The status payload. For all updates except ERROR, the data package is described by OnStatusCallbackUpdateData.\nFor Errors, the data is shaped as OnStatusErrorCallbackData",
426
+ "complexTypes": [
427
+ "OnStatusCallbackUpdateData",
428
+ "OnStatusTrackChangedData",
429
+ "OnStatusErrorCallbackData"
430
+ ],
431
+ "type": "OnStatusCallbackUpdateData | OnStatusTrackChangedData | OnStatusErrorCallbackData"
432
+ }
433
+ ]
434
+ },
435
+ {
436
+ "name": "OnStatusCallbackUpdateData",
437
+ "slug": "onstatuscallbackupdatedata",
438
+ "docs": "Contains the current track status as of the moment an onStatus update event is emitted.",
439
+ "tags": [],
440
+ "methods": [],
441
+ "properties": [
442
+ {
443
+ "name": "trackId",
444
+ "tags": [],
445
+ "docs": "The ID of this track corresponding to this event. If the track is null or has completed, this value is \"NONE\".\nThis will happen when skipping to the beginning or end of the playlist.\nIf the playlist is completed, this value is \"INVALID\"",
446
+ "complexTypes": [],
447
+ "type": "string"
448
+ },
449
+ {
450
+ "name": "isStream",
451
+ "tags": [],
452
+ "docs": "Boolean indicating whether this is a streaming track.",
453
+ "complexTypes": [],
454
+ "type": "boolean"
455
+ },
456
+ {
457
+ "name": "currentIndex",
458
+ "tags": [],
459
+ "docs": "The current index of the track in the playlist.",
460
+ "complexTypes": [],
461
+ "type": "number"
462
+ },
463
+ {
464
+ "name": "status",
465
+ "tags": [],
466
+ "docs": "The current status of the track, as a string. This is used\nto summarize the various event states that a track can be in; e.g. \"playing\" is true for any number\nof track statuses. The Javascript interface takes care of this for you; this field is here only for reference.",
467
+ "complexTypes": [],
468
+ "type": "'error' | 'unknown' | 'ready' | 'playing' | 'loading' | 'paused'"
469
+ },
470
+ {
471
+ "name": "currentPosition",
472
+ "tags": [],
473
+ "docs": "Current playback position of the reported track.",
474
+ "complexTypes": [],
475
+ "type": "number"
476
+ },
477
+ {
478
+ "name": "duration",
479
+ "tags": [],
480
+ "docs": "The known duration of the reported track. For streams or malformed MP3's, this value will be 0.",
481
+ "complexTypes": [],
482
+ "type": "number"
483
+ },
484
+ {
485
+ "name": "playbackPercent",
486
+ "tags": [],
487
+ "docs": "Progress of track playback, as a percent, in the range 0 - 100",
488
+ "complexTypes": [],
489
+ "type": "number"
490
+ },
491
+ {
492
+ "name": "bufferPercent",
493
+ "tags": [],
494
+ "docs": "Buffering progress of the track, as a percent, in the range 0 - 100",
495
+ "complexTypes": [],
496
+ "type": "number"
497
+ },
498
+ {
499
+ "name": "bufferStart",
500
+ "tags": [],
501
+ "docs": "The starting position of the buffering progress. For now, this is always reported as 0.",
502
+ "complexTypes": [],
503
+ "type": "number"
504
+ },
505
+ {
506
+ "name": "bufferEnd",
507
+ "tags": [],
508
+ "docs": "The maximum position, in seconds, of the track buffer. For now, only the buffer with the maximum\nplayback position is reported, even if there are other segments (due to seeking, for example).\nPractically speaking you don't need to worry about that, as in both implementations the\nminor gaps are automatically filled in by the underlying players.",
509
+ "complexTypes": [],
510
+ "type": "number"
511
+ }
512
+ ]
513
+ },
514
+ {
515
+ "name": "OnStatusTrackChangedData",
516
+ "slug": "onstatustrackchangeddata",
517
+ "docs": "Reports information about the playlist state when a track changes.\nIncludes the new track, its index, and the state of the playlist.",
518
+ "tags": [],
519
+ "methods": [],
520
+ "properties": [
521
+ {
522
+ "name": "currentItem",
523
+ "tags": [],
524
+ "docs": "The new track that has been selected. May be null if you are at the end of the playlist,\nor the playlist has been emptied.",
525
+ "complexTypes": [
526
+ "AudioTrack"
527
+ ],
528
+ "type": "AudioTrack"
529
+ },
530
+ {
531
+ "name": "currentIndex",
532
+ "tags": [],
533
+ "docs": "The 0-based index of the new track. If the playlist has ended or been cleared, this will be -1.",
534
+ "complexTypes": [],
535
+ "type": "number"
536
+ },
537
+ {
538
+ "name": "isAtEnd",
539
+ "tags": [],
540
+ "docs": "Indicates whether the playlist is now currently at the last item in the list.",
541
+ "complexTypes": [],
542
+ "type": "boolean"
543
+ },
544
+ {
545
+ "name": "isAtBeginning",
546
+ "tags": [],
547
+ "docs": "Indicates whether the playlist is now at the first item in the list",
548
+ "complexTypes": [],
549
+ "type": "boolean"
550
+ },
551
+ {
552
+ "name": "hasNext",
553
+ "tags": [],
554
+ "docs": "Indicates if there are additional playlist items after the current item.",
555
+ "complexTypes": [],
556
+ "type": "boolean"
557
+ },
558
+ {
559
+ "name": "hasPrevious",
560
+ "tags": [],
561
+ "docs": "Indicates if there are any items before this one in the playlist.",
562
+ "complexTypes": [],
563
+ "type": "boolean"
564
+ }
565
+ ]
566
+ },
567
+ {
568
+ "name": "AudioTrack",
569
+ "slug": "audiotrack",
570
+ "docs": "An audio track for playback by the playlist.",
571
+ "tags": [],
572
+ "methods": [],
573
+ "properties": [
574
+ {
575
+ "name": "isStream",
576
+ "tags": [],
577
+ "docs": "This item is a streaming asset. Make sure this is set to true for stream URLs,\notherwise you will get odd behavior when the asset is paused.",
578
+ "complexTypes": [],
579
+ "type": "boolean | undefined"
580
+ },
581
+ {
582
+ "name": "trackId",
583
+ "tags": [],
584
+ "docs": "trackId is optional and if not passed in, an auto-generated UUID will be used.",
585
+ "complexTypes": [],
586
+ "type": "string | undefined"
587
+ },
588
+ {
589
+ "name": "assetUrl",
590
+ "tags": [],
591
+ "docs": "URL of the asset; can be local, a URL, or a streaming URL.\nIf the asset is a stream, make sure that isStream is set to true,\notherwise the plugin can't properly handle the item's buffer.",
592
+ "complexTypes": [],
593
+ "type": "string"
594
+ },
595
+ {
596
+ "name": "albumArt",
597
+ "tags": [],
598
+ "docs": "The local or remote URL to an image asset to be shown for this track.\nIf this is null, the plugin's default image is used.",
599
+ "complexTypes": [],
600
+ "type": "string | undefined"
601
+ },
602
+ {
603
+ "name": "artist",
604
+ "tags": [],
605
+ "docs": "The track's artist",
606
+ "complexTypes": [],
607
+ "type": "string"
608
+ },
609
+ {
610
+ "name": "album",
611
+ "tags": [],
612
+ "docs": "Album the track belongs to",
613
+ "complexTypes": [],
614
+ "type": "string"
615
+ },
616
+ {
617
+ "name": "title",
618
+ "tags": [],
619
+ "docs": "Title of the track",
620
+ "complexTypes": [],
621
+ "type": "string"
622
+ }
623
+ ]
624
+ },
625
+ {
626
+ "name": "OnStatusErrorCallbackData",
627
+ "slug": "onstatuserrorcallbackdata",
628
+ "docs": "Represents an error reported by the onStatus callback.",
629
+ "tags": [],
630
+ "methods": [],
631
+ "properties": [
632
+ {
633
+ "name": "code",
634
+ "tags": [],
635
+ "docs": "Error code",
636
+ "complexTypes": [
637
+ "RmxAudioErrorType"
638
+ ],
639
+ "type": "RmxAudioErrorType"
640
+ },
641
+ {
642
+ "name": "message",
643
+ "tags": [],
644
+ "docs": "The error, as a message",
645
+ "complexTypes": [],
646
+ "type": "string"
647
+ }
648
+ ]
649
+ },
374
650
  {
375
651
  "name": "AudioPlayerOptions",
376
652
  "slug": "audioplayeroptions",
@@ -399,7 +675,7 @@
399
675
  "complexTypes": [
400
676
  "NotificationOptions"
401
677
  ],
402
- "type": "NotificationOptions | undefined"
678
+ "type": "NotificationOptions"
403
679
  }
404
680
  ]
405
681
  },
@@ -434,7 +710,7 @@
434
710
  "Array",
435
711
  "AudioTrack"
436
712
  ],
437
- "type": "AudioTrack[]"
713
+ "type": "Array<AudioTrack>"
438
714
  },
439
715
  {
440
716
  "name": "options",
@@ -1284,64 +1560,6 @@
1284
1560
  }
1285
1561
  ]
1286
1562
  },
1287
- {
1288
- "name": "AudioTrack",
1289
- "slug": "audiotrack",
1290
- "docs": "An audio track for playback by the playlist.",
1291
- "tags": [],
1292
- "methods": [],
1293
- "properties": [
1294
- {
1295
- "name": "isStream",
1296
- "tags": [],
1297
- "docs": "This item is a streaming asset. Make sure this is set to true for stream URLs,\notherwise you will get odd behavior when the asset is paused.",
1298
- "complexTypes": [],
1299
- "type": "boolean | undefined"
1300
- },
1301
- {
1302
- "name": "trackId",
1303
- "tags": [],
1304
- "docs": "trackId is optional and if not passed in, an auto-generated UUID will be used.",
1305
- "complexTypes": [],
1306
- "type": "string | undefined"
1307
- },
1308
- {
1309
- "name": "assetUrl",
1310
- "tags": [],
1311
- "docs": "URL of the asset; can be local, a URL, or a streaming URL.\nIf the asset is a stream, make sure that isStream is set to true,\notherwise the plugin can't properly handle the item's buffer.",
1312
- "complexTypes": [],
1313
- "type": "string"
1314
- },
1315
- {
1316
- "name": "albumArt",
1317
- "tags": [],
1318
- "docs": "The local or remote URL to an image asset to be shown for this track.\nIf this is null, the plugin's default image is used.",
1319
- "complexTypes": [],
1320
- "type": "string | undefined"
1321
- },
1322
- {
1323
- "name": "artist",
1324
- "tags": [],
1325
- "docs": "The track's artist",
1326
- "complexTypes": [],
1327
- "type": "string"
1328
- },
1329
- {
1330
- "name": "album",
1331
- "tags": [],
1332
- "docs": "Album the track belongs to",
1333
- "complexTypes": [],
1334
- "type": "string"
1335
- },
1336
- {
1337
- "name": "title",
1338
- "tags": [],
1339
- "docs": "Title of the track",
1340
- "complexTypes": [],
1341
- "type": "string"
1342
- }
1343
- ]
1344
- },
1345
1563
  {
1346
1564
  "name": "PlaylistItemOptions",
1347
1565
  "slug": "playlistitemoptions",
@@ -1412,7 +1630,7 @@
1412
1630
  "Array",
1413
1631
  "AudioTrack"
1414
1632
  ],
1415
- "type": "AudioTrack[]"
1633
+ "type": "Array<AudioTrack>"
1416
1634
  }
1417
1635
  ]
1418
1636
  },
@@ -1454,7 +1672,7 @@
1454
1672
  "Array",
1455
1673
  "RemoveItemOptions"
1456
1674
  ],
1457
- "type": "RemoveItemOptions[]"
1675
+ "type": "Array<RemoveItemOptions>"
1458
1676
  }
1459
1677
  ]
1460
1678
  },
@@ -1615,5 +1833,208 @@
1615
1833
  ]
1616
1834
  }
1617
1835
  ],
1618
- "enums": []
1836
+ "enums": [
1837
+ {
1838
+ "name": "RmxAudioStatusMessage",
1839
+ "slug": "rmxaudiostatusmessage",
1840
+ "members": [
1841
+ {
1842
+ "name": "RMXSTATUS_NONE",
1843
+ "value": "0",
1844
+ "tags": [],
1845
+ "docs": "The starting state of the plugin. You will never see this value;\nit changes before the callbacks are even registered to report changes to this value."
1846
+ },
1847
+ {
1848
+ "name": "RMXSTATUS_REGISTER",
1849
+ "value": "1",
1850
+ "tags": [],
1851
+ "docs": "Raised when the plugin registers the callback handler for onStatus callbacks.\nYou will probably not be able to see this (nor do you need to)."
1852
+ },
1853
+ {
1854
+ "name": "RMXSTATUS_INIT",
1855
+ "value": "2",
1856
+ "tags": [],
1857
+ "docs": "Reserved for future use"
1858
+ },
1859
+ {
1860
+ "name": "RMXSTATUS_ERROR",
1861
+ "value": "5",
1862
+ "tags": [],
1863
+ "docs": "Indicates an error is reported in the 'value' field."
1864
+ },
1865
+ {
1866
+ "name": "RMXSTATUS_LOADING",
1867
+ "value": "10",
1868
+ "tags": [],
1869
+ "docs": "The reported track is being loaded by the player"
1870
+ },
1871
+ {
1872
+ "name": "RMXSTATUS_CANPLAY",
1873
+ "value": "11",
1874
+ "tags": [],
1875
+ "docs": "The reported track is able to begin playback"
1876
+ },
1877
+ {
1878
+ "name": "RMXSTATUS_LOADED",
1879
+ "value": "15",
1880
+ "tags": [],
1881
+ "docs": "The reported track has loaded 100% of the file (either from disc or network)"
1882
+ },
1883
+ {
1884
+ "name": "RMXSTATUS_STALLED",
1885
+ "value": "20",
1886
+ "tags": [],
1887
+ "docs": "(iOS only): Playback has stalled due to insufficient network"
1888
+ },
1889
+ {
1890
+ "name": "RMXSTATUS_BUFFERING",
1891
+ "value": "25",
1892
+ "tags": [],
1893
+ "docs": "Reports an update in the reported track's buffering status"
1894
+ },
1895
+ {
1896
+ "name": "RMXSTATUS_PLAYING",
1897
+ "value": "30",
1898
+ "tags": [],
1899
+ "docs": "The reported track has started (or resumed) playing"
1900
+ },
1901
+ {
1902
+ "name": "RMXSTATUS_PAUSE",
1903
+ "value": "35",
1904
+ "tags": [],
1905
+ "docs": "The reported track has been paused, either by the user or by the system.\n(iOS only): This value is raised when MP3's are malformed (but still playable).\nThese require the user to explicitly press play again. This can be worked\naround and is on the TODO list."
1906
+ },
1907
+ {
1908
+ "name": "RMXSTATUS_PLAYBACK_POSITION",
1909
+ "value": "40",
1910
+ "tags": [],
1911
+ "docs": "Reports a change in the reported track's playback position."
1912
+ },
1913
+ {
1914
+ "name": "RMXSTATUS_SEEK",
1915
+ "value": "45",
1916
+ "tags": [],
1917
+ "docs": "The reported track has seeked.\nOn Android, only the plugin consumer can generate this (Notification controls on Android do not include a seek bar).\nOn iOS, the Command Center includes a seek bar so this will be reported when the user has seeked via Command Center."
1918
+ },
1919
+ {
1920
+ "name": "RMXSTATUS_COMPLETED",
1921
+ "value": "50",
1922
+ "tags": [],
1923
+ "docs": "The reported track has completed playback."
1924
+ },
1925
+ {
1926
+ "name": "RMXSTATUS_DURATION",
1927
+ "value": "55",
1928
+ "tags": [],
1929
+ "docs": "The reported track's duration has changed. This is raised once, when duration is updated for the first time.\nFor streams, this value is never reported."
1930
+ },
1931
+ {
1932
+ "name": "RMXSTATUS_STOPPED",
1933
+ "value": "60",
1934
+ "tags": [],
1935
+ "docs": "All playback has stopped, probably because the plugin is shutting down."
1936
+ },
1937
+ {
1938
+ "name": "RMX_STATUS_SKIP_FORWARD",
1939
+ "value": "90",
1940
+ "tags": [],
1941
+ "docs": "The playlist has skipped forward to the next track.\nOn both Android and iOS, this will be raised if the notification controls/Command Center were used to skip.\nIt is unlikely you need to consume this event: RMXSTATUS_TRACK_CHANGED is also reported when this occurs,\nso you can generalize your track change handling in one place."
1942
+ },
1943
+ {
1944
+ "name": "RMX_STATUS_SKIP_BACK",
1945
+ "value": "95",
1946
+ "tags": [],
1947
+ "docs": "The playlist has skipped back to the previous track.\nOn both Android and iOS, this will be raised if the notification controls/Command Center were used to skip.\nIt is unlikely you need to consume this event: RMXSTATUS_TRACK_CHANGED is also reported when this occurs,\nso you can generalize your track change handling in one place."
1948
+ },
1949
+ {
1950
+ "name": "RMXSTATUS_TRACK_CHANGED",
1951
+ "value": "100",
1952
+ "tags": [],
1953
+ "docs": "Reported when the current track has changed in the native player. This event contains full data about\nthe new track, including the index and the actual track itself. The type of the 'value' field in this case\nis OnStatusTrackChangedData."
1954
+ },
1955
+ {
1956
+ "name": "RMXSTATUS_PLAYLIST_COMPLETED",
1957
+ "value": "105",
1958
+ "tags": [],
1959
+ "docs": "The entire playlist has completed playback.\nAfter this event has been raised, the current item is set to null and the current index to -1."
1960
+ },
1961
+ {
1962
+ "name": "RMXSTATUS_ITEM_ADDED",
1963
+ "value": "110",
1964
+ "tags": [],
1965
+ "docs": "An item has been added to the playlist. For the setPlaylistItems and addAllItems methods, this status is\nraised once for every track in the collection."
1966
+ },
1967
+ {
1968
+ "name": "RMXSTATUS_ITEM_REMOVED",
1969
+ "value": "115",
1970
+ "tags": [],
1971
+ "docs": "An item has been removed from the playlist. For the removeItems and clearAllItems methods, this status is\nraised once for every track that was removed."
1972
+ },
1973
+ {
1974
+ "name": "RMXSTATUS_PLAYLIST_CLEARED",
1975
+ "value": "120",
1976
+ "tags": [],
1977
+ "docs": "All items have been removed from the playlist"
1978
+ },
1979
+ {
1980
+ "name": "RMXSTATUS_VIEWDISAPPEAR",
1981
+ "value": "200",
1982
+ "tags": [],
1983
+ "docs": "Just for testing.. you don't need this and in fact can never receive it, the plugin is destroyed before it can be raised."
1984
+ }
1985
+ ]
1986
+ },
1987
+ {
1988
+ "name": "RmxAudioErrorType",
1989
+ "slug": "rmxaudioerrortype",
1990
+ "members": [
1991
+ {
1992
+ "name": "RMXERR_NONE_ACTIVE",
1993
+ "value": "0",
1994
+ "tags": [],
1995
+ "docs": ""
1996
+ },
1997
+ {
1998
+ "name": "RMXERR_ABORTED",
1999
+ "value": "1",
2000
+ "tags": [],
2001
+ "docs": ""
2002
+ },
2003
+ {
2004
+ "name": "RMXERR_NETWORK",
2005
+ "value": "2",
2006
+ "tags": [],
2007
+ "docs": ""
2008
+ },
2009
+ {
2010
+ "name": "RMXERR_DECODE",
2011
+ "value": "3",
2012
+ "tags": [],
2013
+ "docs": ""
2014
+ },
2015
+ {
2016
+ "name": "RMXERR_NONE_SUPPORTED",
2017
+ "value": "4",
2018
+ "tags": [],
2019
+ "docs": ""
2020
+ }
2021
+ ]
2022
+ }
2023
+ ],
2024
+ "typeAliases": [
2025
+ {
2026
+ "name": "PlaylistStatusChangeCallback",
2027
+ "slug": "playliststatuschangecallback",
2028
+ "docs": "",
2029
+ "types": [
2030
+ {
2031
+ "text": "(data: PlaylistStatusChangeCallbackArg): void",
2032
+ "complexTypes": [
2033
+ "PlaylistStatusChangeCallbackArg"
2034
+ ]
2035
+ }
2036
+ ]
2037
+ }
2038
+ ],
2039
+ "pluginConfigs": []
1619
2040
  }
package/dist/esm/web.d.ts CHANGED
@@ -30,6 +30,8 @@ export declare class PlaylistWeb extends WebPlugin implements PlaylistPlugin {
30
30
  skipForward(): Promise<void>;
31
31
  skipBack(): Promise<void>;
32
32
  setPlaybackRate(options: SetPlaybackRateOptions): Promise<void>;
33
+ setMediaSessionRemoteControlMetadata(): Promise<void>;
34
+ mediaSessionControlsHandler(actionDetails: MediaSessionActionDetails): Promise<void>;
33
35
  registerHtmlListeners(position?: number): void;
34
36
  protected getCurrentTrackId(): string | undefined;
35
37
  protected getCurrentIndex(): number;
package/dist/esm/web.js CHANGED
@@ -193,6 +193,48 @@ export class PlaylistWeb extends WebPlugin {
193
193
  }
194
194
  return Promise.reject();
195
195
  }
196
+ async setMediaSessionRemoteControlMetadata() {
197
+ const audioTrack = this.currentTrack;
198
+ if (!navigator.mediaSession) {
199
+ console.warn('Media Session API not available');
200
+ return Promise.reject();
201
+ }
202
+ navigator.mediaSession.metadata = new MediaMetadata({
203
+ title: audioTrack.title,
204
+ artist: audioTrack.artist,
205
+ album: audioTrack.album,
206
+ artwork: [
207
+ { src: audioTrack.albumArt, sizes: '96x96', type: 'image/jpeg' },
208
+ { src: audioTrack.albumArt, sizes: '128x128', type: 'image/jpeg' },
209
+ { src: audioTrack.albumArt, sizes: '192x192', type: 'image/jpeg' },
210
+ { src: audioTrack.albumArt, sizes: '256x256', type: 'image/jpeg' },
211
+ { src: audioTrack.albumArt, sizes: '384x384', type: 'image/jpeg' },
212
+ { src: audioTrack.albumArt, sizes: '512x512', type: 'image/jpeg' },
213
+ ]
214
+ });
215
+ navigator.mediaSession.setActionHandler('play', (details) => { this.mediaSessionControlsHandler(details); });
216
+ navigator.mediaSession.setActionHandler('pause', (details) => { this.mediaSessionControlsHandler(details); });
217
+ navigator.mediaSession.setActionHandler('nexttrack', (details) => { this.mediaSessionControlsHandler(details); });
218
+ navigator.mediaSession.setActionHandler('previoustrack', (details) => { this.mediaSessionControlsHandler(details); });
219
+ return Promise.resolve();
220
+ }
221
+ async mediaSessionControlsHandler(actionDetails) {
222
+ switch (actionDetails.action) {
223
+ case 'play':
224
+ this.play();
225
+ break;
226
+ case 'pause':
227
+ this.pause();
228
+ break;
229
+ case 'nexttrack':
230
+ this.skipForward();
231
+ break;
232
+ case 'previoustrack':
233
+ this.skipBack();
234
+ break;
235
+ }
236
+ return Promise.resolve();
237
+ }
196
238
  // register events
197
239
  /*
198
240
  private registerHlsListeners(hls: Hls, position?: number) {
@@ -220,6 +262,7 @@ export class PlaylistWeb extends WebPlugin {
220
262
  (_a = this.audio) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', canPlayListener);
221
263
  };
222
264
  if (this.audio) {
265
+ this.audio.addEventListener('loadstart', () => { this.setMediaSessionRemoteControlMetadata(); });
223
266
  this.audio.addEventListener('canplay', canPlayListener);
224
267
  this.audio.addEventListener('playing', () => {
225
268
  this.updateStatus(RmxAudioStatusMessage.RMXSTATUS_PLAYING, this.getCurrentTrackStatus('playing'));