AudioMusicParam class

Background Music Playback Information

The information, including playback ID, file path, and loop times, is passed in the startPlayMusic API.

  1. If you play the same music track multiple times, please use the same ID instead of a separate ID for each playback.

  2. If you want to play different music tracks at the same time, use different IDs for them.

  3. If you use the same ID to play a music track different from the current one, the SDK will stop the current one before playing the new one.

Constructors

AudioMusicParam({required int id, required String path, int loopCount = 0, bool publish = false, bool isShortFile = false, int startTimeMS = 0, int endTimeMS = 0})

Properties

endTimeMS int
  • Field description: The point in time in milliseconds for ending music playback. 0 indicates that playback continues till the end of the music track.
  • getter/setter pair
    hashCode int
    The hash code for this object.
    no setterinherited
    id int
  • Field description: Music ID.
  • Note: The SDK supports playing multiple music tracks. IDs are used to distinguish different music tracks and control their start, end, volume, etc.
  • getter/setter pair
    isShortFile bool
  • Field description: Whether the music played is a short music track.
  • Valid values:
    • true: short music track that needs to be looped;
    • false (default): normal-length music track.
  • getter/setter pair
    loopCount int
  • Field description: Number of times the music track is looped.
  • Valid values: 0 or any positive integer. 0 (default) indicates that the music is played once, 1 twice, and so on.
  • getter/setter pair
    path String
  • Field description: Absolute path of the music file or URL.
  • Supported formats: mp3, aac, m4a, wav.
  • getter/setter pair
    publish bool
  • Field description: Whether to send the music to remote users.
  • Valid values:
    • true: remote users can hear the music played locally;
    • false (default): only the local user can hear the music.
  • getter/setter pair
    runtimeType Type
    A representation of the runtime type of the object.
    no setterinherited
    startTimeMS int
  • Field description: The point in time in milliseconds for starting music playback.
  • getter/setter pair

    Methods

    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a nonexistent method or property is accessed.
    inherited
    toString() String
    A string representation of this object.
    inherited

    Operators

    operator ==(Object other) bool
    The equality operator.
    inherited