icecast-metadata-player
Advanced tools
Comparing version 1.16.5 to 1.17.0
{ | ||
"name": "icecast-metadata-player", | ||
"version": "1.16.5", | ||
"version": "1.17.0", | ||
"description": "Simple to use Javascript class that plays an Icecast stream with real-time metadata updates", | ||
@@ -46,6 +46,6 @@ "keywords": [ | ||
"babel-plugin-syntax-dynamic-import": "^6.18.0", | ||
"prettier": "^3.0.1", | ||
"prettier": "^3.0.3", | ||
"terser-webpack-plugin": "^5.3.9", | ||
"webpack": "^5.88.2", | ||
"webpack-bundle-analyzer": "^4.9.0", | ||
"webpack-bundle-analyzer": "^4.9.1", | ||
"webpack-cli": "^5.1.4" | ||
@@ -52,0 +52,0 @@ }, |
@@ -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.16.5.main.min.js" download>`icecast-metadata-player-1.16.5.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.16.5.synaudio.min.js" download>`icecast-metadata-player-1.16.5.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.16.5.mediasource.min.js" download>`icecast-metadata-player-1.16.5.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.16.5.mpeg.min.js" download>`icecast-metadata-player-1.16.5.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.16.5.flac.min.js" download>`icecast-metadata-player-1.16.5.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.16.5.opus.min.js" download>`icecast-metadata-player-1.16.5.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.16.5.vorbis.min.js" download>`icecast-metadata-player-1.16.5.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.16.5.common.min.js" download>`icecast-metadata-player-1.16.5.common.min.js`</a> | Common functions (webaudio) | | ||
2. Add a `<script>` tag referencing `icecast-metadata-player-1.16.5.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.0.main.min.js" download>`icecast-metadata-player-1.17.0.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.0.synaudio.min.js" download>`icecast-metadata-player-1.17.0.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.0.mediasource.min.js" download>`icecast-metadata-player-1.17.0.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.0.mpeg.min.js" download>`icecast-metadata-player-1.17.0.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.0.flac.min.js" download>`icecast-metadata-player-1.17.0.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.0.opus.min.js" download>`icecast-metadata-player-1.17.0.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.0.vorbis.min.js" download>`icecast-metadata-player-1.17.0.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.0.common.min.js" download>`icecast-metadata-player-1.17.0.common.min.js`</a> | Common functions (webaudio) | | ||
2. Add a `<script>` tag referencing `icecast-metadata-player-1.17.0.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.16.5.main.min.js"></script> | ||
<script src="icecast-metadata-player-1.17.0.main.min.js"></script> | ||
<script> | ||
@@ -347,2 +347,6 @@ const onMetadata = (metadata) => { | ||
* The playback method is automatically chosen depending on browser support for the codec of the Icecast stream. | ||
* `authentication` (optional) **Default** *disabled* | ||
* When supplied, sets the user and password to use when connecting to an authenticated stream. | ||
* This sets the `Authorization` header in the HTTP request using basic auth. | ||
* Example `{user: 'myuser', password: 'mypassword'}` | ||
@@ -439,3 +443,3 @@ #### Retry Options | ||
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.16.5.min.js.map` located in the build folder of this project to the location along side `icecast-metadata-player-1.16.5.min.js` in your website. | ||
* To enable the source map, simply copy `icecast-metadata-player-1.17.0.min.js.map` located in the build folder of this project to the location along side `icecast-metadata-player-1.17.0.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. | ||
@@ -450,2 +454,7 @@ | ||
> I have an authenticated stream, and when I supply credentials in the `authentication` option, I get a CORS error. | ||
* Ensure your Icecast server or your proxy has `Authorization` listed in the `Access-Control-Allow-Headers` header when it responses to the CORS `OPTIONS` request. | ||
* Example: `Access-Control-Allow-Headers: Origin, Icy-MetaData, Range, Authorization` | ||
### Warning messages | ||
@@ -452,0 +461,0 @@ |
@@ -50,2 +50,3 @@ export const noOp = () => {}; | ||
export const enableCodecUpdate = Symbol(); | ||
export const authentication = Symbol(); | ||
@@ -52,0 +53,0 @@ // methods |
@@ -43,2 +43,3 @@ /** | ||
retryTimeout, | ||
authentication, | ||
// methods | ||
@@ -128,2 +129,3 @@ fireEvent, | ||
(options.playbackMethod ?? instance[playbackMethod]) || "mediasource", | ||
[authentication]: options.authentication ?? instance[authentication], | ||
}; | ||
@@ -130,0 +132,0 @@ |
@@ -29,2 +29,3 @@ import { | ||
noOp, | ||
authentication, | ||
} from "./global.js"; | ||
@@ -126,5 +127,13 @@ | ||
const headers = instanceVariables[hasIcy] ? { "Icy-MetaData": 1 } : {}; | ||
if (instanceVariables[authentication]) { | ||
const auth = instanceVariables[authentication]; | ||
headers["Authorization"] = | ||
"Basic " + btoa(auth.user + ":" + auth.password); | ||
} | ||
const res = await fetch(this._endpoint, { | ||
method: "GET", | ||
headers: instanceVariables[hasIcy] ? { "Icy-MetaData": 1 } : {}, | ||
headers, | ||
signal: instanceVariables[abortController].signal, | ||
@@ -131,0 +140,0 @@ }); |
@@ -129,2 +129,10 @@ declare module "icecast-metadata-player" { | ||
playbackMethod?: "mediasource" | "webaudio" | "html5"; | ||
/** | ||
* Sets authentication credentials used for authenticating to private streams | ||
*/ | ||
authentication?: { | ||
user: string; | ||
password: string; | ||
}; | ||
} | ||
@@ -131,0 +139,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
1402069
4442
503