@aidenlx/player
Version:
Headless web components that make integrating media on the a web a breeze.
54 lines (53 loc) • 1.6 kB
JavaScript
import "../chunks/chunk.S6UZ27SZ.js";
import {
createContext,
storeRecordSubscription,
writable
} from "@vidstack/foundation";
import { MediaType } from "./MediaType";
import { createTimeRanges } from "./time-ranges";
import { ViewType } from "./ViewType";
function createMediaStore() {
return {
autoplay: writable(false),
autoplayError: writable(void 0),
buffered: writable(createTimeRanges()),
duration: writable(0),
bufferedAmount: writable(0),
canLoad: writable(false),
canPlay: writable(false),
canFullscreen: writable(false),
controls: writable(false),
currentPoster: writable(""),
currentSrc: writable(""),
currentTime: writable(0),
ended: writable(false),
error: writable(void 0),
fullscreen: writable(false),
idle: writable(false),
loop: writable(false),
mediaType: writable(MediaType.Unknown),
muted: writable(false),
paused: writable(true),
played: writable(createTimeRanges()),
playing: writable(false),
playsinline: writable(false),
seekable: writable(createTimeRanges()),
seekableAmount: writable(0),
seeking: writable(false),
started: writable(false),
viewType: writable(ViewType.Unknown),
volume: writable(1),
waiting: writable(false)
};
}
const mediaStoreContext = createContext(createMediaStore);
function mediaStoreSubscription(host, property, onChange) {
return storeRecordSubscription(host, mediaStoreContext, property, onChange);
}
export {
createMediaStore,
mediaStoreContext,
mediaStoreSubscription
};
//# sourceMappingURL=store.js.map