@aidenlx/player
Version:
Headless web components that make integrating media on the a web a breeze.
67 lines • 2.49 kB
TypeScript
import { DisposalBin } from '@vidstack/foundation';
import { LitElement } from 'lit';
import type { MediaVolumeChange, MediaVolumeChangeEvent } from '../events';
import type { MediaProviderElement } from '../provider';
/**
* This element is responsible for synchronizing elements of the type `MediaProviderElement`.
*
* Synchronization includes:
*
* - Single media playback (eg: user plays a video while another is already playing, so we pause
* the newly inactive player).
*
* - Shared media volume (eg: user sets desired volume to 50% on one player, and they expect it to
* be consistent across all players).
*
* - Saving media volume to local storage (eg: user sets desired to volume 50%, they leave
* the site, and when they come back they expect it to be 50% without any interaction).
*
* @tagname vds-media-sync
* @slot - Used to pass in content, typically a media player/provider.
* @events ./media-sync.events.ts
* @example
* ```html
* <vds-media-sync
* single-playback
* shared-volume
* volume-storage-key="@vidstack/volume"
* >
* <!-- ... -->
* </vds-media-sync>
* ```
*/
export declare class MediaSyncElement extends LitElement {
/**
* Whether only one is player should be playing at a time.
*
* @default false
*/
singlePlayback: boolean;
/**
* Whether media volume should be in-sync across all media players.
*
* @default false
*/
sharedVolume: boolean;
/**
* If a value is provided, volume will be saved to local storage to the given key as it's
* updated. In addition, when a media provider connects to the manager, it's volume will be
* set to the saved volume level. If no value is provided, nothing is saved or retrieved.
*
* Note that this includes both the volume and muted state.
*
* @default undefined
*/
volumeStorageKey?: string;
disconnectedCallback(): void;
render(): import("lit").TemplateResult<1>;
protected _mediaProvider?: MediaProviderElement;
protected _mediaProviderDisposal: DisposalBin;
get mediaProvider(): MediaProviderElement | undefined;
protected _handleMediaProviderConnect: void;
protected _handleMediaPlay(): void;
protected _handleMediaVolumeChange(event: MediaVolumeChangeEvent): void;
protected _getSavedMediaVolume(): MediaVolumeChange | undefined;
protected _saveMediaVolume(event: MediaVolumeChangeEvent): void;
}
//# sourceMappingURL=MediaSyncElement.d.ts.map