icecast-metadata-player
Advanced tools
Comparing version 1.17.6 to 1.17.7
{ | ||
"name": "icecast-metadata-player", | ||
"version": "1.17.6", | ||
"version": "1.17.7", | ||
"description": "Simple to use Javascript class that plays an Icecast stream with real-time metadata updates", | ||
@@ -52,5 +52,5 @@ "keywords": [ | ||
"babel-plugin-syntax-dynamic-import": "^6.18.0", | ||
"prettier": "^3.2.5", | ||
"prettier": "^3.4.2", | ||
"terser-webpack-plugin": "^5.3.10", | ||
"webpack": "^5.91.0", | ||
"webpack": "^5.97.0", | ||
"webpack-bundle-analyzer": "^4.10.2", | ||
@@ -57,0 +57,0 @@ "webpack-cli": "^5.1.4" |
@@ -81,11 +81,11 @@ # Icecast Metadata Player | ||
| - | - | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.6.main.min.js" download>`icecast-metadata-player-1.17.6.main.min.js`</a> | Core functionality (playback, metadata) <br> **Use this file in your `<script>` tag** | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.6.synaudio.min.js" download>`icecast-metadata-player-1.17.6.synaudio.min.js`</a> | Gapless playback support | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.6.mediasource.min.js" download>`icecast-metadata-player-1.17.6.mediasource.min.js`</a> | Mediasource playback support | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.6.mpeg.min.js" download>`icecast-metadata-player-1.17.6.mpeg.min.js`</a> | MPEG playback support (webaudio) | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.6.flac.min.js" download>`icecast-metadata-player-1.17.6.flac.min.js`</a> | FLAC playback support (webaudio) | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.6.opus.min.js" download>`icecast-metadata-player-1.17.6.opus.min.js`</a> | Opus playback support (webaudio) | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.6.vorbis.min.js" download>`icecast-metadata-player-1.17.6.vorbis.min.js`</a> | Vorbis playback support (webaudio) | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.6.common.min.js" download>`icecast-metadata-player-1.17.6.common.min.js`</a> | Common functions (webaudio) | | ||
2. Add a `<script>` tag referencing `icecast-metadata-player-1.17.6.main.min.js` in your html. | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.7.main.min.js" download>`icecast-metadata-player-1.17.7.main.min.js`</a> | Core functionality (playback, metadata) <br> **Use this file in your `<script>` tag** | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.7.synaudio.min.js" download>`icecast-metadata-player-1.17.7.synaudio.min.js`</a> | Gapless playback support | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.7.mediasource.min.js" download>`icecast-metadata-player-1.17.7.mediasource.min.js`</a> | Mediasource playback support | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.7.mpeg.min.js" download>`icecast-metadata-player-1.17.7.mpeg.min.js`</a> | MPEG playback support (webaudio) | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.7.flac.min.js" download>`icecast-metadata-player-1.17.7.flac.min.js`</a> | FLAC playback support (webaudio) | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.7.opus.min.js" download>`icecast-metadata-player-1.17.7.opus.min.js`</a> | Opus playback support (webaudio) | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.7.vorbis.min.js" download>`icecast-metadata-player-1.17.7.vorbis.min.js`</a> | Vorbis playback support (webaudio) | | ||
| <a href="https://raw.githubusercontent.com/eshaz/icecast-metadata-js/master/src/icecast-metadata-player/build/icecast-metadata-player-1.17.7.common.min.js" download>`icecast-metadata-player-1.17.7.common.min.js`</a> | Common functions (webaudio) | | ||
2. Add a `<script>` tag referencing `icecast-metadata-player-1.17.7.main.min.js` in your html. | ||
3. `IcecastMetadataPlayer` is made available as a global variable in your webpage to use wherever. | ||
@@ -96,3 +96,3 @@ | ||
```html | ||
<script src="icecast-metadata-player-1.17.6.main.min.js"></script> | ||
<script src="icecast-metadata-player-1.17.7.main.min.js"></script> | ||
<script> | ||
@@ -442,3 +442,3 @@ const onMetadata = (metadata) => { | ||
IcecastMetadataPlayer builds are supplied with a source map, which allows the minified code to be viewed as fully formatted code in a browser debugger. | ||
* To enable the source map, simply copy `icecast-metadata-player-1.17.6.min.js.map` located in the build folder of this project to the location along side `icecast-metadata-player-1.17.6.min.js` in your website. | ||
* To enable the source map, simply copy `icecast-metadata-player-1.17.7.min.js.map` located in the build folder of this project to the location along side `icecast-metadata-player-1.17.7.min.js` in your website. | ||
* The source map can be used to step through and debug the code as well as see the full variable names and file origin on stack traces if you are facing any issues. | ||
@@ -445,0 +445,0 @@ |
@@ -85,2 +85,4 @@ /** | ||
const play = Symbol(); | ||
export default class IcecastMetadataPlayer extends EventClass { | ||
@@ -241,3 +243,3 @@ static *[getNextEndpointGenerator](instance) { | ||
[onAudioPlay]: () => { | ||
this.play(); | ||
this[play](onAudioPlay); | ||
}, | ||
@@ -274,4 +276,4 @@ [onAudioPause]: () => { | ||
event.PLAYBACK_ERROR, | ||
"The audio element encountered an error." + | ||
(errors[error?.code] || ""), | ||
"The audio element encountered an error.", | ||
errors[error?.code] || e, | ||
); | ||
@@ -399,3 +401,11 @@ } | ||
async play() { | ||
return this[play](); | ||
} | ||
async [play](source) { | ||
if (this.state === state.STOPPED) { | ||
if (source !== onAudioPlay && this.audioElement.paused) | ||
// start the audio element immediately after user action to prevent iOS Safari playback permissions issues | ||
this.audioElement.play(); | ||
const playing = new Promise((resolve) => { | ||
@@ -485,2 +495,3 @@ this.addEventListener(event.PLAY, resolve, { once: true }); | ||
}); | ||
p.get(this)[playerFactory].player.enablePlayButton(); | ||
} | ||
@@ -487,0 +498,0 @@ } |
@@ -52,3 +52,3 @@ import { | ||
this._player.codecUpdateQueue = this._codecUpdateQueue; | ||
this._player.enablePlayButton(PlayerFactory.supportedPlaybackMethods); | ||
this._player.enablePlayButton(); | ||
@@ -55,0 +55,0 @@ this._unprocessedFrames = []; |
@@ -9,3 +9,2 @@ import { state, event, fireEvent, NOT_SYNCED } from "../global.js"; | ||
this._audioElement.crossOrigin = "anonymous"; | ||
this._audioElement.loop = false; | ||
this._audioElement.preload = "none"; | ||
@@ -70,2 +69,3 @@ | ||
this._metadataLoadedTimestamp = performance.now(); | ||
this._audioElement.loop = false; | ||
this._audioElement.src = null; | ||
@@ -72,0 +72,0 @@ this._audioElement.srcObject = null; |
@@ -96,3 +96,3 @@ import { | ||
this._changingContainer = true; | ||
this.enablePlayButton(["mediasource"]); | ||
this.enablePlayButton(); | ||
this._init(); | ||
@@ -99,0 +99,0 @@ this.start().then(() => (this._changingContainer = false)); |
@@ -86,24 +86,15 @@ import { | ||
enablePlayButton(supportedSources) { | ||
enablePlayButton() { | ||
// set the audio element an empty source to enable the play button | ||
this._audioElement.removeAttribute("src"); | ||
this._audioElement.src = null; | ||
this._audioElement.srcObject = null; | ||
// mp3 32kbs silence | ||
this._audioElement.src = | ||
"data:audio/mpeg;base64,//sQxAAABFgC/SCEYACCgB9AAAAAppppVCAHBAEIgBByw9WD5+J8ufwxiDED" + | ||
"sMfE+D4fwG/RUGCx6VO4awVxV3qDtQNPiXKnZUNSwKuUDR6IgaeoGg7Fg6pMQU1FMy4xMDCqqqqqqqr/+xL" + | ||
"EB4PAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq" + | ||
"qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo="; | ||
if (supportedSources.includes("mediasource")) { | ||
// MediaSourcePlayer | ||
this._audioElement.src = URL.createObjectURL(new MediaSource()); | ||
} else if (supportedSources.includes("webaudio")) { | ||
this._mediaStream = new MediaStream(); | ||
this._audioElement.srcObject = this._mediaStream; | ||
} else if (supportedSources.includes("html5")) { | ||
// HTML5Player | ||
// mp3 32kbs silence | ||
this._audioElement.src = | ||
"data:audio/mpeg;base64,//sQxAAABFgC/SCEYACCgB9AAAAAppppVCAHBAEIgBByw9WD5+J8ufwxiDED" + | ||
"sMfE+D4fwG/RUGCx6VO4awVxV3qDtQNPiXKnZUNSwKuUDR6IgaeoGg7Fg6pMQU1FMy4xMDCqqqqqqqr/+xL" + | ||
"EB4PAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq" + | ||
"qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo="; | ||
this._audioElement.loop = true; | ||
} | ||
this._audioElement.loop = true; | ||
} | ||
@@ -110,0 +101,0 @@ |
@@ -273,2 +273,3 @@ import { | ||
this._audioElement.loop = false; | ||
this._audioElement.srcObject = this._mediaStream.stream; // triggers canplay event | ||
@@ -275,0 +276,0 @@ } |
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
4588
1470361