Skip to content

Commit

Permalink
Rename ThumbnailMetadata to ThumbnailTrackInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
peaBerberian committed Dec 10, 2024
1 parent 1c2f553 commit d99d4cd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
10 changes: 5 additions & 5 deletions demo/scripts/components/ThumbnailPreview.tsx
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions demo/scripts/modules/player/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import type {
ITextTrack,
IVideoRepresentation,
IVideoTrack,
IThumbnailMetadata,
IThumbnailTrackInfo,
} from "../../../../src/public_types";

RxPlayer.addFeatures([
Expand Down Expand Up @@ -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 ?? [];
},

Expand Down
8 changes: 6 additions & 2 deletions src/main_thread/api/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ import type {
ITrackType,
IModeInformation,
IWorkerSettings,
IThumbnailMetadata,
IThumbnailTrackInfo,
IThumbnailRenderingOptions,
} from "../../public_types";
import type { IThumbnailResponse } from "../../transports";
Expand Down Expand Up @@ -761,7 +761,11 @@ class Player extends EventEmitter<IPublicAPIEvent> {
* seconds.
* @returns {Array.<Object>|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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/public_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/**
Expand Down

0 comments on commit d99d4cd

Please sign in to comment.