Interface VideoAPI

Video API methods

interface VideoAPI {
    comments: {
        (videoId: string): Promise<Video.Comment[]>;
        (videoId: string, showAll: true): Promise<Unredacted[]>;
    };
    download: <T = ReadableStream>(
        videoId: string,
        options?: RequestOptions,
    ) => Promise<Rev.Response<T>>;
    downloadChapter: (
        chapter: Video.Chapter,
        options?: RequestOptions,
    ) => Promise<Blob>;
    downloadSupplemental: {
        <T = Blob>(
            file: SupplementalFile,
            options?: RequestOptions,
        ): Promise<T>;
        <T = Blob>(
            videoId: string,
            fileId: string,
            options?: RequestOptions,
        ): Promise<T>;
    };
    downloadThumbnail: {
        <T = Blob>(thumbnailUrl: string, options?: RequestOptions): Promise<T>;
        <T = Blob>(
            query: { imageId: string },
            options?: RequestOptions,
        ): Promise<T>;
        <T = Blob>(
            query: { videoId: string },
            options?: RequestOptions,
        ): Promise<T>;
    };
    downloadThumbnailSheet: {
        <T = Blob>(
            thumbnailSheet: string,
            options?: RequestOptions,
        ): Promise<T>;
        <T = Blob>(
            thumbnailSheet: ThumbnailConfiguration,
            options?: RequestOptions,
        ): Promise<T>;
        <T = Blob>(
            thumbnailSheet: { sheetIndex?: string | number; videoId: string },
            options?: RequestOptions,
        ): Promise<T>;
    };
    downloadTranscription: {
        <T = Blob>(
            transcription: Transcription,
            options?: RequestOptions,
        ): Promise<T>;
        <T = Blob>(
            videoId: string,
            language: string,
            options?: RequestOptions,
        ): Promise<T>;
    };
    replace: (
        videoId: string,
        file: FileUploadType,
        options?: VideoOptions,
    ) => Promise<void>;
    report: {
        (options?: VideoReportOptions): VideoReportRequest;
        (videoId: string, options?: VideoReportOptions): VideoReportRequest;
    };
    summaryStatistics: {
        (
            videoId: string,
            startDate?: undefined,
            endDate?: undefined,
            options?: RequestOptions,
        ): Promise<SummaryStatistics>;
        (
            videoId: string,
            startDate: string | Date,
            endDate?: undefined,
            options?: RequestOptions,
        ): Promise<SummaryStatistics>;
        (
            videoId: string,
            startDate: string | Date,
            endDate: string | Date,
            options?: RequestOptions,
        ): Promise<SummaryStatistics>;
    };
    upload: (
        file: FileUploadType,
        metadata?: UploadMetadata,
        options?: VideoOptions,
    ) => Promise<string>;
    chapters(
        videoId: string,
        options?: RequestOptions,
    ): Promise<Video.Chapter[]>;
    convertDualStreamToSwitched(videoId: string): Promise<void>;
    createExternalAccess(
        videoId: string,
        request: ExternalAccess.Request,
    ): Promise<void>;
    delete(videoId: string, options?: RequestOptions): Promise<void>;
    deleteExternalAccess(
        videoId: string,
        request: Pick<ExternalAccess.Request, "emails">,
    ): Promise<void>;
    deleteTranscription(
        videoId: string,
        language?: SupportedLanguage | SupportedLanguage[],
        options?: RequestOptions,
    ): Promise<void>;
    details(videoId: string, options?: RequestOptions): Promise<Video.Details>;
    edit(
        videoId: string,
        keepRanges: ClipRequest[],
        options?: RequestOptions,
    ): Promise<any>;
    generateMetadata(
        videoId: string,
        fields?: MetadataGenerationField[],
        options?: RequestOptions,
    ): Promise<void>;
    generateMetadataStatus(
        videoId: string,
        options?: RequestOptions,
    ): Promise<MetadataGenerationStatus>;
    getTranslationStatus(
        videoId: string,
        language: SupportedLanguage,
        options?: RequestOptions,
    ): Promise<Transcription.StatusEnum>;
    listDeleted(
        query?: RemovedVideosQuery,
        options?: Rev.SearchOptions<RemovedVideoItem>,
    ): ISearchRequest<RemovedVideoItem>;
    listExternalAccess(
        videoId: string,
        q?: string,
        options?: Rev.SearchOptions<ExternalAccess>,
    ): ISearchRequest<ExternalAccess>;
    migrate(
        videoId: string,
        options: MigrateRequest,
        requestOptions?: RequestOptions,
    ): Promise<void>;
    patch(
        videoId: string,
        operations: PatchOperation[],
        options?: RequestOptions,
    ): Promise<void>;
    playbackInfo(videoId: string): Promise<Video.Playback>;
    playbackUrls(
        videoId: string,
        __namedParameters?: PlaybackUrlsRequest,
        options?: RequestOptions,
    ): Promise<Video.PlaybackUrlsResponse>;
    renewExternalAccess(
        videoId: string,
        request: Pick<ExternalAccess.Request, "emails" | "noEmail">,
    ): Promise<RenewResponse>;
    revokeExternalAccess(
        videoId: string,
        request: Pick<ExternalAccess.Request, "emails">,
    ): Promise<void>;
    search(
        query?: Video.SearchOptions,
        options?: Rev.SearchOptions<Video.SearchHit>,
    ): ISearchRequest<Video.SearchHit>;
    searchDetailed(
        query?: Video.SearchOptions,
        options?: Rev.SearchOptions<VideoSearchDetailedItem>,
    ): ISearchRequest<VideoSearchDetailedItem>;
    setAudioLanguage(
        video: string | Video.Details,
        language: SupportedLanguage,
        trackIndex?: number,
        options?: RequestOptions,
    ): Promise<void>;
    setCustomField(
        videoId: string,
        customField: Pick<Admin.CustomField, "id" | "value">,
    ): Promise<void>;
    setTitle(videoId: string, title: string): Promise<void>;
    status(videoId: string, options?: RequestOptions): Promise<StatusResponse>;
    supplementalFiles(
        videoId: string,
        options?: RequestOptions,
    ): Promise<SupplementalFile[]>;
    thumbnailConfiguration(
        videoId: string,
        options?: RequestOptions,
    ): Promise<ThumbnailConfiguration>;
    transcribe(
        videoId: string,
        language: SupportedLanguage | Transcription.Request,
        options?: RequestOptions,
    ): Promise<Transcription.Status>;
    transcriptions(
        videoId: string,
        options?: RequestOptions,
    ): Promise<Transcription[]>;
    transcriptionStatus(
        videoId: string,
        transcriptionId: string,
        options?: RequestOptions,
    ): Promise<Transcription.Status>;
    translate(
        videoId: string,
        source: TranslateSource,
        target: SupportedLanguage | SupportedLanguage[],
        options?: RequestOptions,
    ): Promise<TranslateResult>;
    trim(
        videoId: string,
        removedSegments: { end: string; start: string }[],
    ): Promise<any>;
    uniqueSessionsReport(
        videoId: string,
        options?: UniqueSessionReportOptions,
    ): VideoReportRequest;
    update(
        videoId: string,
        metadata: UpdateRequest,
        options?: RequestOptions,
    ): Promise<void>;
    waitTranscode(
        videoId: string,
        options?: WaitTranscodeOptions,
        requestOptions?: RequestOptions,
    ): Promise<StatusResponse>;
}

Hierarchy

  • API
    • VideoAPI

Properties

comments: {
    (videoId: string): Promise<Video.Comment[]>;
    (videoId: string, showAll: true): Promise<Unredacted[]>;
}

Type declaration

    • (videoId: string): Promise<Video.Comment[]>
    • get list of comments on a video

      set showAll param to true to include un-redacted values of comments (admin only)

      Parameters

      • videoId: string

      Returns Promise<Video.Comment[]>

    • (videoId: string, showAll: true): Promise<Unredacted[]>
    • get list of comments on a video

      set showAll param to true to include un-redacted values of comments (admin only)

      Parameters

      • videoId: string
      • showAll: true

      Returns Promise<Unredacted[]>

download: <T = ReadableStream>(
    videoId: string,
    options?: RequestOptions,
) => Promise<Rev.Response<T>>

Type declaration

    • <T = ReadableStream>(
          videoId: string,
          options?: RequestOptions,
      ): Promise<Rev.Response<T>>
    • Download a video. does not parse the output body. Note that content is sent as transfer-encoding: chunked;

      Type Parameters

      • T = ReadableStream

      Parameters

      Returns Promise<Rev.Response<T>>

downloadChapter: (
    chapter: Video.Chapter,
    options?: RequestOptions,
) => Promise<Blob>

Type declaration

    • (chapter: Video.Chapter, options?: RequestOptions): Promise<Blob>
    • download specified chapter. The chapter object has an imageUrl, this just wraps the functionality and adds the authorization header

      Parameters

      Returns Promise<Blob>

downloadSupplemental: {
    <T = Blob>(file: SupplementalFile, options?: RequestOptions): Promise<T>;
    <T = Blob>(
        videoId: string,
        fileId: string,
        options?: RequestOptions,
    ): Promise<T>;
}
downloadThumbnail: {
    <T = Blob>(thumbnailUrl: string, options?: RequestOptions): Promise<T>;
    <T = Blob>(
        query: { imageId: string },
        options?: RequestOptions,
    ): Promise<T>;
    <T = Blob>(
        query: { videoId: string },
        options?: RequestOptions,
    ): Promise<T>;
}
downloadThumbnailSheet: {
    <T = Blob>(thumbnailSheet: string, options?: RequestOptions): Promise<T>;
    <T = Blob>(
        thumbnailSheet: ThumbnailConfiguration,
        options?: RequestOptions,
    ): Promise<T>;
    <T = Blob>(
        thumbnailSheet: { sheetIndex?: string | number; videoId: string },
        options?: RequestOptions,
    ): Promise<T>;
}

Type declaration

    • <T = Blob>(thumbnailSheet: string, options?: RequestOptions): Promise<T>
    • Download the thumbnail sheet image for a video

      Type Parameters

      • T = Blob

      Parameters

      • thumbnailSheet: string

        the thumbnailSheetUri or Thumbnail Configuration (get from video.thumbnailConfiguration)

      • Optionaloptions: RequestOptions

      Returns Promise<T>

    • <T = Blob>(
          thumbnailSheet: ThumbnailConfiguration,
          options?: RequestOptions,
      ): Promise<T>
    • Download the thumbnail sheet image for a video

      Type Parameters

      • T = Blob

      Parameters

      Returns Promise<T>

    • <T = Blob>(
          thumbnailSheet: { sheetIndex?: string | number; videoId: string },
          options?: RequestOptions,
      ): Promise<T>
    • Download the thumbnail sheet image for a video

      Type Parameters

      • T = Blob

      Parameters

      • thumbnailSheet: { sheetIndex?: string | number; videoId: string }

        the thumbnailSheetUri or Thumbnail Configuration (get from video.thumbnailConfiguration)

      • Optionaloptions: RequestOptions

      Returns Promise<T>

downloadTranscription: {
    <T = Blob>(
        transcription: Transcription,
        options?: RequestOptions,
    ): Promise<T>;
    <T = Blob>(
        videoId: string,
        language: string,
        options?: RequestOptions,
    ): Promise<T>;
}
replace: (
    videoId: string,
    file: FileUploadType,
    options?: VideoOptions,
) => Promise<void>

Type declaration

report: {
    (options?: VideoReportOptions): VideoReportRequest;
    (videoId: string, options?: VideoReportOptions): VideoReportRequest;
}
summaryStatistics: {
    (
        videoId: string,
        startDate?: undefined,
        endDate?: undefined,
        options?: RequestOptions,
    ): Promise<SummaryStatistics>;
    (
        videoId: string,
        startDate: string | Date,
        endDate?: undefined,
        options?: RequestOptions,
    ): Promise<SummaryStatistics>;
    (
        videoId: string,
        startDate: string | Date,
        endDate: string | Date,
        options?: RequestOptions,
    ): Promise<SummaryStatistics>;
}
upload: (
    file: FileUploadType,
    metadata?: UploadMetadata,
    options?: VideoOptions,
) => Promise<string>

Type declaration

    • (
          file: FileUploadType,
          metadata?: UploadMetadata,
          options?: VideoOptions,
      ): Promise<string>
    • Upload a video, and returns the resulting video ID

      Parameters

      • file: FileUploadType

        A File/Blob. if using nodejs you can also pass in the path to a file

      • metadata: UploadMetadata = ...

        metadata to add to video (title, etc.) - see API docs

      • options: VideoOptions = {}

        Additional RequestInit options, as well as customizing the contentType/contentLength/filename of the file in the POST upload form (only needed if they can't be inferred from input)

      Returns Promise<string>

      the resulting video id

      const rev = new RevClient(...config...);
      await rev.connect();

      // if browser - pass in File
      const file = fileInputElement.files[0];
      // if nodejs - can pass in path to file instead
      // const file = "/path/to/local/video.mp4";
      // upload returns resulting ID when complete
      const videoId = await rev.upload.video(file, {
      uploader: 'username.of.uploader',
      title: 'video uploaded via the API',
      //categories: [EXISTING_REV_CATEGORY_NAME],
      unlisted: true,
      isActive: true
      /// ...any additional metadata
      });

Methods

  • Parameters

    • videoId: string

    Returns Promise<void>

  • Example of using the video search API to search for videos, then getting the details of each video

    Parameters

    Returns ISearchRequest<VideoSearchDetailedItem>

    This method can cause timeouts if iterating through a very large number of results, as the search scroll cursor has a timeout of ~5 minutes. Consider getting all search results first, then getting details

  • Helper - update the audio language for a video. If index isn't specified then update the default language

    Parameters

    • video: string | Video.Details

      videoId or video details (from video.details api call)

    • language: SupportedLanguage

      language to use, for example 'en'

    • OptionaltrackIndex: number

      index of audio track - if not supplied then update default or first index

    • Optionaloptions: RequestOptions

    Returns Promise<void>

  • Use the Patch API to update a single Custom Field.

    Parameters

    • videoId: string

      id of video to update

    • customField: Pick<Admin.CustomField, "id" | "value">

      the custom field object (with id and value)

    Returns Promise<void>

  • This is an example of using the video Patch API to only update a single field

    Parameters

    • videoId: string
    • title: string

    Returns Promise<void>

  • Parameters

    • videoId: string
    • removedSegments: { end: string; start: string }[]

    Returns Promise<any>

    Use edit() API instead