diff --git a/demo/scripts/components/ThumbnailPreview.tsx b/demo/scripts/components/ThumbnailPreview.tsx index 6fbf5363ed..3e87576f2f 100644 --- a/demo/scripts/components/ThumbnailPreview.tsx +++ b/demo/scripts/components/ThumbnailPreview.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import useModuleState from "../lib/useModuleState"; import { IPlayerModule } from "../modules/player"; -import { IThumbnailMetadata } from "../../../src/public_types"; +import { IThumbnailTrackInfo } from "../../../src/public_types"; const DIV_SPINNER_STYLE = { backgroundColor: "gray", @@ -92,8 +92,8 @@ export default function ThumbnailPreview({ startSpinnerTimeoutIfNotAlreadyStarted(); - // load thumbnail after a 40ms timer to avoid doing too many requests - // when the user quickly moves its pointer or whatever is calling this + // load thumbnail after a timer to avoid doing too many requests when the + // user quickly moves its pointer or whatever is calling this loadThumbnailTimeout = window.setTimeout(() => { loadThumbnailTimeout = null; if (showVideoThumbnail) { @@ -118,8 +118,8 @@ export default function ThumbnailPreview({ } }); } else { - const metadata = player.actions.getThumbnailMetadata(ceiledTime); - const thumbnailTrack = metadata.reduce((acc: IThumbnailMetadata | null, t) => { + const metadata = player.actions.getAvailableThumbnailTracks(ceiledTime); + const thumbnailTrack = metadata.reduce((acc: IThumbnailTrackInfo | null, t) => { if (acc === null || acc.height === undefined) { return t; } diff --git a/demo/scripts/modules/player/index.ts b/demo/scripts/modules/player/index.ts index 7e609e7770..62003da614 100644 --- a/demo/scripts/modules/player/index.ts +++ b/demo/scripts/modules/player/index.ts @@ -40,7 +40,7 @@ import type { ITextTrack, IVideoRepresentation, IVideoTrack, - IThumbnailMetadata, + IThumbnailTrackInfo, } from "../../../../src/public_types"; RxPlayer.addFeatures([ @@ -342,8 +342,8 @@ const PlayerModule = declareModule( player.unMute(); }, - getThumbnailMetadata(time: number): IThumbnailMetadata[] { - const metadata = player.getThumbnailMetadata({ time }); + getAvailableThumbnailTracks(time: number): IThumbnailTrackInfo[] { + const metadata = player.getAvailableThumbnailTracks({ time }); return metadata ?? []; }, diff --git a/src/main_thread/api/public_api.ts b/src/main_thread/api/public_api.ts index 84b67fcdb2..d5abbc820d 100644 --- a/src/main_thread/api/public_api.ts +++ b/src/main_thread/api/public_api.ts @@ -102,7 +102,7 @@ import type { ITrackType, IModeInformation, IWorkerSettings, - IThumbnailMetadata, + IThumbnailTrackInfo, IThumbnailRenderingOptions, } from "../../public_types"; import type { IThumbnailResponse } from "../../transports"; @@ -761,7 +761,11 @@ class Player extends EventEmitter { * seconds. * @returns {Array.|null} */ - public getThumbnailMetadata({ time }: { time: number }): IThumbnailMetadata[] | null { + public getAvailableThumbnailTracks({ + time, + }: { + time: number; + }): IThumbnailTrackInfo[] | null { if (this._priv_contentInfos === null || this._priv_contentInfos.manifest === null) { return null; } diff --git a/src/public_types.ts b/src/public_types.ts index bfd23a87de..2ae3c3cafa 100644 --- a/src/public_types.ts +++ b/src/public_types.ts @@ -1285,8 +1285,8 @@ export interface IModeInformation { useWorker: boolean; } -/** Information returned by the `getThumbnailMetadata` method. */ -export interface IThumbnailMetadata { +/** Information returned by the `getAvailableThumbnailsTracks` method. */ +export interface IThumbnailTrackInfo { /** Identifier identifying a particular thumbnail track. */ id: string; /**