/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Microsoft Live Share SDK License. */ import { DataObjectFactory } from "@fluidframework/aqueduct/legacy"; import { LiveTelemetryLogger, UserMeetingRole } from "@microsoft/live-share"; import { LiveDataObject } from "@microsoft/live-share/internal"; import { MediaPlayerSynchronizer } from "./MediaPlayerSynchronizer.js"; import { ExtendedMediaSessionAction, ExtendedMediaSessionActionHandler } from "./MediaSessionExtensions.js"; import { LiveMediaSessionCoordinator, IMediaPlayerState } from "./LiveMediaSessionCoordinator.js"; import { MediaSessionActionThrottler } from "./MediaSessionActionThrottler.js"; import { IMediaPlayer } from "./IMediaPlayer.js"; import { SharedObjectKind } from "fluid-framework"; /** * Live fluid object that synchronizes media playback across multiple clients. */ export declare class LiveMediaSessionClass extends LiveDataObject { private _actionThrottler; private _logger?; private _requestPlayerStateHandler?; private _coordinator?; private readonly _actionHandlers; private _synchronizing?; private _updateTimer; private _lastUpdateTime; /** * The objects fluid type name. */ static readonly TypeName = "@microsoft/fluid-media:SharedMediaSession"; /** * The objects fluid type factory. */ static readonly factory: DataObjectFactory; /** * Extension point that lets applications replace the default logic for throttling the sessions * local sync behavior. * * @remarks * The `LiveMediaCoordinator` is fairly aggressive at wanting to keep the local media player * in sync with the rest of the group. This aggressiveness can result in the coordinator sending * new sync actions before the local player has finished responding to the previous sync action. * The `ActionThrottler` gives apps fine grain control over how aggressive they want sync to be. * * By default, a `RepeatedAction` throttler is used which prevents the same sync action from * being sent within an adjustable time period. */ get actionThrottler(): MediaSessionActionThrottler; set actionThrottler(value: MediaSessionActionThrottler); /** * The group coordinator for the session. */ get coordinator(): LiveMediaSessionCoordinator; /** * Returns the logger used by the session and coordinator. * * @remarks * This is used by the `MediaPlayerSynchronizer` to log events. */ get logger(): LiveTelemetryLogger; /** * Initialize the object to begin sending/receiving group playback updates through this DDS. * * @param allowedRoles Optional. List of roles allowed to group transport operations like play/pause/seek/setTrack. * * @returns a void promise that resolves once complete. * * @throws error when `.initialize()` has already been called for this class instance. */ initialize(allowedRoles?: UserMeetingRole[]): Promise; /** * Registers an action handler with the session. * @param action Name of the action to register a handler for. * @param handler Function called when the action is triggered. */ setActionHandler(action: ExtendedMediaSessionAction, handler: ExtendedMediaSessionActionHandler | MediaSessionActionHandler | null): void; /** * Registers a handler that will be queried anytime the group coordinate needs to know the * local players transport state and position. */ setRequestPlayerStateHandler(handler: () => IMediaPlayerState): void; /** * Begins synchronizing the playback of a media element. * @param player Something that "looks like" and HTML Media Element. * @returns A new synchronizer instance. Call `synchronizer.end()` to stop synchronizing the elements playback. */ synchronize(player: IMediaPlayer): MediaPlayerSynchronizer; protected hasInitialized(): Promise; private checkWaitPointHit; private getCurrentPlayerState; private dispatchAction; } /** * Live fluid object that synchronizes media playback across multiple clients. */ export type LiveMediaSession = LiveMediaSessionClass; export declare const LiveMediaSession: typeof LiveMediaSessionClass & SharedObjectKind; //# sourceMappingURL=LiveMediaSession.d.ts.map