Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Methods

Abstract cancelDownload

  • cancelDownload(resourceID: string): Promise<void>
  • Cancel download of music resource.

    Available since: 3.11.0 Description: Cancel download of music resource. Use case: After starting to download music resources, use this interface to cancel the corresponding download task. When to call: After starting the download [download]. Caution: When a valid resourceID is passed in, only unfinished download tasks will be cancelled. When empty is passed in, all unfinished download tasks will be canceled.

    Parameters

    • resourceID: string

      the resource ID corresponding to the song or accompaniment.

    Returns Promise<void>

Abstract clearCache

  • clearCache(): Promise<void>
  • Clear cache.

    Available since: 2.13.0 Description: When using this module, some cache files may be generated, which can be cleared through this interface. Use case: Used to clear the cache of the App. When to call: After initializing the copyrighted music [createCopyrightedMusic].

    Returns Promise<void>

Abstract download

  • Download music resource.

    Available since: 2.13.0 Description: Download music resource. It can only be played after downloading successfully. Use case: After obtaining the music resource authorization, use this interface to download the corresponding resources. When to call: After initializing the copyrighted music success [initCopyrightedMusic]. Caution: Downloading copyrighted music resources is affected by the Internet.

    Parameters

    • resourceID: string

      the resource ID corresponding to the song or accompaniment.

    Returns Promise<ZegoCopyrightedMusicDownloadResult>

    download song or accompaniment result.

Abstract getAverageScore

  • getAverageScore(resourceID: string): Promise<number>
  • Get average score.

    Available since: 2.15.0 Description: Get the average score. Use case: Can be used to display the average score on the view. When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.

    Parameters

    • resourceID: string

      the resource ID corresponding to the accompaniment or accompaniment clip.

    Returns Promise<number>

    Average score.

Abstract getCacheSize

  • getCacheSize(): Promise<number>
  • Get cache size.

    Available since: 2.13.0 Description: When using this module, some cache files may be generated, and the size of the cache file can be obtained through this interface. Use case: Used to display the cache size of the App. When to call: After initializing the copyrighted music [createCopyrightedMusic].

    Returns Promise<number>

    cache file size, in byte.

Abstract getCurrentPitch

  • getCurrentPitch(resourceID: string): Promise<number>
  • Get real-time pitch data.

    Available since: 2.15.0 Description: Get real-time pitch data. Use case: Can be used to display real-time pitch lines on the view. When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.

    Parameters

    • resourceID: string

      the resource ID corresponding to the song or accompaniment.

    Returns Promise<number>

    Real-time pitch data.

Abstract getDuration

  • getDuration(resourceID: string): Promise<number>
  • Get the playing time of a song or accompaniment file.

    Available since: 2.13.0 Description: Get the playing time of a song or accompaniment file. Use case: Can be used to display the playing time information of the song or accompaniment on the view. When to call: After initializing the copyrighted music success [initCopyrightedMusic].

    Parameters

    • resourceID: string

      the resource ID corresponding to the song or accompaniment.

    Returns Promise<number>

Abstract getFullScore

  • getFullScore(resourceID: string): Promise<number>
  • Get full score .

    Available since: 3.0.2 Description: Get the full score. Use case: Can be used to display the full score on the view. When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.

    Parameters

    • resourceID: string

      the resource ID corresponding to the accompaniment or accompaniment clip.

    Returns Promise<number>

    Full score.

Abstract getKrcLyricByToken

  • Get lyrics in krc format.

    Available since: 2.13.0 Description: Get verbatim lyrics, support parsing lyrics word by word. Use case: Used to display lyrics word by word. When to call: After initializing the copyrighted music success [initCopyrightedMusic].

    Parameters

    • krcToken: string

      The krcToken obtained when calling [requestResource] for accompaniment or climax clips, or when obtaining shared resources through the [getSharedResource] interface. For more details, please refer to https://doc-zh.zego.im/article/15079#2_2

    Returns Promise<ZegoCopyrightedMusicGetKrcLyricByTokenResult>

    The result of getting verbatim lyrics.

Abstract getLrcLyric

  • Get lyrics in lrc format.

    Available since: 3.12.0 Description: Get lyrics in lrc format, support parsing lyrics line by line. Use case: Used to display lyrics line by line. When to call: After initializing the copyrighted music success [initCopyrightedMusic].

    Parameters

    Returns Promise<ZegoCopyrightedMusicGetLrcLyricResult>

    The result of getting lrc lyrics.

Abstract getPreviousScore

  • getPreviousScore(resourceID: string): Promise<number>
  • Get the score of the previous sentence.

    Available since: 2.15.0 Description: Get the score of the previous sentence. Use case: Can be used to display the score of each sentence on the view. When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.

    Parameters

    • resourceID: string

      the resource ID corresponding to the accompaniment or accompaniment clip.

    Returns Promise<number>

    The score of the previous sentence.

Abstract getSharedResource

  • Get shared music resource.

    Available since: 3.12.0 Description: In addition to obtaining the basic information of the song (duration, song name, singer, etc.), and the most important resource id that can be used for local playback, there are also some related authentications information. Use case: Get copyrighted songs for local playback. Related APIs: After a user in the room calls the [requestresource] interface to request a music resource successfully, other users in the room can call this interface to get the music resource for free once. When to call: After initializing the copyrighted music [initCopyrightedMusic]. Note: Each resource has a unique resource ID. The resources obtained by calling this API are time-sensitive, the valid duration is the minimum value between the SDK life cycle and 24-hour.

    Parameters

    Returns Promise<ZegoCopyrightedMusicGetSharedResourceResult>

    Result of getting shared music resource.

Abstract getStandardPitch

  • Get standard pitch data.

    Available since: 2.15.0 Description: Get standard pitch data. Use case: Can be used to display standard pitch lines on the view. Caution: Only accompaniment or climactic clip assets have pitch lines.

    Parameters

    • resourceID: string

      the resource ID corresponding to the accompaniment or accompaniment clip.

    Returns Promise<ZegoCopyrightedMusicGetStandardPitchResult>

    The result of getting standard pitch data.

Abstract getTotalScore

  • getTotalScore(resourceID: string): Promise<number>
  • Get total score .

    Available since: 2.15.0 Description: Get the total score. Use case: Can be used to display the total score on the view. When to call: It can be called after playing the copyright accompaniment or accompaniment clip and starting to score.

    Parameters

    • resourceID: string

      the resource ID corresponding to the accompaniment or accompaniment clip.

    Returns Promise<number>

    Total score.

Abstract initCopyrightedMusic

  • Initialize the copyrighted music module.

    Available since: 2.13.0 Description: Initialize the copyrighted music so that you can use the function of the copyrighted music later. When to call: After call [createCopyrightedMusic] and [loginRoom]. Caution: 1. The real user information must be passed in, otherwise the song resources cannot be obtained for playback. 2. The user ID set when initializing copyrighted music needs to be the same as the user ID set when logging in to the room.

    Parameters

    Returns Promise<ZegoCopyrightedMusicInitResult>

    The result of initializing the copyrighted music module.

Abstract off

  • off<CopyrightedMusicEventType>(event: CopyrightedMusicEventType, callback: undefined | ZegoCopyrightedMusicListener[CopyrightedMusicEventType]): void
  • Unregister the event handler of copyrighted music

    Type parameters

    Parameters

    • event: CopyrightedMusicEventType

      Event type.

    • callback: undefined | ZegoCopyrightedMusicListener[CopyrightedMusicEventType]

      Call back.

    Returns void

Abstract on

  • on<CopyrightedMusicEventType>(event: CopyrightedMusicEventType, callback: ZegoCopyrightedMusicListener[CopyrightedMusicEventType]): void
  • Register the event handler of copyrighted music

    Type parameters

    Parameters

    • event: CopyrightedMusicEventType

      Event type.

    • callback: ZegoCopyrightedMusicListener[CopyrightedMusicEventType]

      Call back.

    Returns void

Abstract pauseScore

  • pauseScore(resourceID: string): Promise<number>
  • Pause scoring.

    Available since: 2.15.0 Description: Pause ongoing scoring,will stop the [OnCurrentPitchValueUpdate] callback. Use case: You can call this interface to pause the scoring function while scoring. When to call: It can be called while grading.

    Parameters

    • resourceID: string

      the resource ID corresponding to the accompaniment or accompaniment clip.

    Returns Promise<number>

    Error code. Refer to the value of [ZegoErrorCode].

Abstract queryCache

  • Query the resource's cache is existed or not.

    Available since: 3.12.0 Description: Query the resource is existed or not, query the Yinsuda resource cache by default Use case: Can be used to check the resource's cache is existed or not When to call: After initializing the copyrighted music success [initCopyrightedMusic].

    Parameters

    Returns Promise<boolean>

Abstract requestResource

  • Request music resource.

    Available since: 3.12.0 Description: In addition to obtaining the basic information of the song (duration, song name, singer, etc.), and the most important resource id that can be used for local playback, there are also some related authentications information. Use case: Get copyrighted songs for local playback and sharing. Related APIs: After a user in the room successfully calls this interface to request a music resource, other users in the room can call the [getsharedresource] interface to get the music resource for free once. When to call: After initializing the copyrighted music [initCopyrightedMusic]. Note:

    1. Each resource has a unique resource ID.
    2. Every time this API is called, it will be billed once, please consult ZEGO business personnel for details.
    3. Each resource has a unique resource ID. The resources obtained by calling this API are time-sensitive, the valid duration is the minimum value between the SDK life cycle and 24-hour.

    Parameters

    Returns Promise<ZegoCopyrightedMusicRequestResourceResult>

    Result of requesting music resource.

Abstract resetScore

  • resetScore(resourceID: string): Promise<number>
  • Reset scoring.

    Available since: 2.15.0 Description: Reset the scores that have already been performed,The [OnCurrentPitchValueUpdate] callback will be stopped and the average or total score will be 0. Use case: Often used in scenes where the same song is re-sung. When to call: It can be called after scoring has been performed.

    Parameters

    • resourceID: string

      the resource ID corresponding to the accompaniment or accompaniment clip.

    Returns Promise<number>

    Error code. Refer to the value of [ZegoErrorCode].

Abstract resumeScore

  • resumeScore(resourceID: string): Promise<number>
  • Resume scoring.

    Available since: 2.15.0 Description: Resume currently paused scoring. Use case: When there is currently paused scoring, this interface can be called to resume the scoring function. When to call: It can be called when there is currently a paused scoring.

    Parameters

    • resourceID: string

      the resource ID corresponding to the accompaniment or accompaniment clip.

    Returns Promise<number>

    Error code. Refer to the value of [ZegoErrorCode].

Abstract sendExtendedRequest

  • Send extended feature request.

    Available since: 2.13.0 Description: Initialize the copyrighted music so that you can use the function of the copyrighted music later. Use case: Used to get a list of songs. When to call: After initializing the copyrighted music success [initCopyrightedMusic].

    Parameters

    • command: string

      request command, details about the commands supported.

    • params: string

      request parameters, each request command has corresponding request parameters.

    Returns Promise<ZegoCopyrightedMusicSendExtendedRequestResult>

    Send the extension function to request the result callback.

Abstract setScoringLevel

  • setScoringLevel(level: number): Promise<void>
  • Set the difficulty level of scoring.

    Available since: 2.22.0 Description: Users can set the scoring difficulty level through this function. When to call: After calling [initCopyrightedMusic] to initialize copyrighted music successfully, call [startScore] to start scoring. Default value: When this function is not called, the difficulty level of scoring is 4. Restrictions: This function does not support dynamic settings. After calling this function successfully, the next call to [startScore] will take effect.

    Parameters

    • level: number

      The difficulty level of scoring. The level ranges from 0 to 4. The scoring difficulty decreases from 0 to 4.

    Returns Promise<void>

Abstract startScore

  • startScore(resourceID: string, pitchValueInterval: number): Promise<number>
  • Start scoring.

    Available since: 2.15.0 Description: Start the scoring function.After starting scoring, the scoring result OnCurrentPitchValueUpdate callback will be received according to the set callback time interval. Use case: Can be used to display the singing score on the view. When to call: After obtaining verbatim lyrics and playing the accompaniment resources of copyrighted music. Restrictions: Only support use this api after [startPublishingStream].

    Parameters

    • resourceID: string

      the resource ID corresponding to the accompaniment or accompaniment clip.

    • pitchValueInterval: number

      the time interval of real-time pitch line callback, in milliseconds, the default is 50 milliseconds.

    Returns Promise<number>

    Error code. Refer to the value of [ZegoErrorCode].

Abstract stopScore

  • stopScore(resourceID: string): Promise<number>
  • Stop scoring.

    Available since: 2.15.0 Description: End the current rating.The [OnCurrentPitchValueUpdate] callback will be stopped, but the average or total score can still be obtained normally. Use case: You can call this interface to end the scoring while scoring. When to call: It can be called while grading.

    Parameters

    • resourceID: string

      the resource ID corresponding to the accompaniment or accompaniment clip.

    Returns Promise<number>

    Error code. Refer to the value of [ZegoErrorCode].

Generated using TypeDoc