Comparing version 1.0.5-3 to 1.0.5
{ | ||
"name": "audio_x", | ||
"version": "1.0.5-3", | ||
"version": "1.0.5", | ||
"description": "The audio player for the gen-x", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -42,3 +42,3 @@ ## audio_x | ||
- Ads Support | ||
- Queue Support and etc. | ||
- ~~Queue Support~~ [✓] Done. | ||
@@ -248,2 +248,53 @@ ### Installation | ||
### Adding and Handling Queue | ||
// Audio_x allows you to play audio in queue. | ||
``` | ||
// To add a queue | ||
const tracks = [track_1, track_2, ...other_tracks] | ||
audio.addQueue(tracks, "DEFAULT"); | ||
NOTE: addQueue takes two parameters one is tracks array and second is playback type i.e "DEFAULT" | "REVERSE" | "SHUFFLE" | ||
if no playbackType is passed audio_x will play it as DEFAULT | ||
// To Play the Queue from the beginning, call addMediaAndPlay like below. | ||
audio.addMediaAndPlay(); | ||
// if you are fetching something dynamically to play audio, such as source of the audio you can do it like below. | ||
audio.addMediaAndPlay(null, async (currentTrack: MediaTrack) => { | ||
const res = await fetch('url); | ||
currentTrack.source = res.data.url; | ||
}); | ||
// This will make sure that the above function gets called before every audio that plays in a queue. | ||
``` | ||
``` | ||
// To add a single track to queue | ||
audio.addToQueue(track); | ||
``` | ||
``` | ||
// To clear Queue | ||
audio.clearQueue(); | ||
``` | ||
``` | ||
// To play Next in Queue | ||
audio.playNext(); | ||
``` | ||
``` | ||
// To play Previous in Queue | ||
audio.playPrevious(); | ||
``` | ||
### Author | ||
@@ -250,0 +301,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
215885
2
308