Release 1.4.0

This commit is contained in:
Jordan Eldredge 2019-05-14 08:04:54 -07:00
parent 6994362e58
commit b3a17c8f99
11 changed files with 32 additions and 16 deletions

View file

@ -1,4 +1,4 @@
## NEXT [UNRELEASED]
## 1.4.0
### Features

View file

@ -21,7 +21,7 @@ Or, you can include it via a script tag:
```html
<!-- You can use this URL, or download it and check it into your own project -->
<script src="https://unpkg.com/webamp@1.0.0/built/webamp.bundle.min.js"></script>
<script src="https://unpkg.com/webamp@1.4.0/built/webamp.bundle.min.js"></script>
```
## Create a container
@ -46,7 +46,9 @@ if(!Webamp.browserIsSupported()) {
throw new Error("What's the point of anything?")
}
// All configuration options are optional.
const webamp = new Webamp({
// Optional.
initialTracks: [{
metaData: {
artist: "DJ Mike Llama",
@ -154,7 +156,14 @@ const options = {
// A boolean indicating if this options should be made
// available when the user is offline.
requiresNetwork: true
}]
}],
// Optional. Provide a custom way to derive `Track` objects from a drop event.
// Useful if your website has some DOM representation of a track that you can map to a URL/blob.
handleTrackDropEvent: async (e) => {
// Return an array of `Track` objects, see documentation below, or `null` to get the default drop behavior.
// You may optionally wrap the return value in a promise.
}
};
const webamp = new Webamp(options);
```
@ -231,7 +240,7 @@ webamp.seekBackward(10);
Seek to a given time within the current track.
**Since** Unreleased
**Since** 1.4.0
```JavaScript
webamp.seekToTime(15.5);
@ -241,7 +250,7 @@ webamp.seekToTime(15.5);
Get the current "playing" status. The return value is one of: `"PLAYING"`, `"STOPPED"`, or `"PAUSED"`.
**Since** Unreleased
**Since** 1.4.0
```JavaScript
const isPlaying = webamp.getMediaStatus() === "PLAYING";
@ -271,7 +280,7 @@ webamp.play();
Stop the currently playing audio. Equivilant to pressing the "stop" button.
**Since** unreleased
**Since** 1.4.0
```JavaScript
webamp.stop();

View file

@ -9,7 +9,7 @@
<div id="app" style="height: 100vh">
<!-- Webamp will attempt to center itself within this div -->
</div>
<script src="https://unpkg.com/webamp@1.3.1/built/webamp.bundle.min.js"></script>
<script src="https://unpkg.com/webamp@1.4.0/built/webamp.bundle.min.js"></script>
<script>
const Webamp = window.Webamp;
new Webamp({

View file

@ -9,7 +9,7 @@
<div id="app" style="height: 100vh">
<!-- Webamp will attempt to center itself within this div -->
</div>
<script src="https://unpkg.com/webamp@1.3.1/built/webamp.bundle.min.js"></script>
<script src="https://unpkg.com/webamp@1.4.0/built/webamp.bundle.min.js"></script>
<script src="https://unpkg.com/butterchurn@2.6.7/lib/butterchurn.min.js"></script>
<script src="https://unpkg.com/butterchurn-presets@2.4.7/lib/butterchurnPresets.min.js"></script>
<script>

View file

@ -0,0 +1,3 @@
# Examples
This directory contains a number of examples of how to add Webamp to a project.

View file

@ -9,7 +9,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"webamp": "1.3.1"
"webamp": "1.4.0"
},
"devDependencies": {
"webpack": "^4.29.6",

View file

@ -10,7 +10,7 @@
"license": "ISC",
"dependencies": {
"butterchurn": "^2.6.7",
"webamp": "1.3.1"
"webamp": "1.4.0"
},
"devDependencies": {
"webpack": "^4.29.6",

4
index.d.ts vendored
View file

@ -127,6 +127,10 @@ interface Options {
}
];
zIndex?: number;
handleTrackDropEvent?: (
e: React.DragEvent<HTMLDivElement>
) => Track[] | null | Promise<Track[] | null>;
}
export default class Webamp {

View file

@ -188,7 +188,7 @@ export function loadMedia(
if (handleTrackDropEvent) {
const tracks = await handleTrackDropEvent(e);
if (tracks) {
if (tracks != null) {
dispatch(loadMediaFiles(tracks, loadStyle, atIndex));
return;
}

View file

@ -105,16 +105,16 @@ interface Options {
requiresNetwork: boolean;
}
];
zIndex: number;
zIndex?: number;
handleTrackDropEvent?: (
e: React.DragEvent<HTMLDivElement>
) => Track[] | null | Promise<Track[] | null>;
}
interface PrivateOptions {
avaliableSkins?: { url: string; name: string }[]; // Old misspelled name
requireJSZip(): Promise<never>; // TODO: Type JSZip
requireMusicMetadata(): Promise<any>; // TODO: Type musicmetadata
handleTrackDropEvent?: (
e: React.DragEvent<HTMLDivElement>
) => Track[] | null | Promise<Track[] | null>;
__initialState?: AppState;
__customMiddlewares?: Middleware[];
__enableMediaLibrary?: boolean;

View file

@ -1,6 +1,6 @@
{
"name": "webamp",
"version": "1.3.2-beta.2",
"version": "1.4.0",
"description": "Winamp 2 implemented in HTML5 and JavaScript",
"main": "built/webamp.bundle.js",
"files": [