Rate this page:

AudioFile

Constructors

AudioFile

Copy URL
fun AudioFile(resId: 

Int

,
audioFileUsage:

AudioFileUsage

):

This API is in beta and subject to change.

Creates AudioFile instance to play audio file from the application resources.

Parameters

  • resId:

    Int

    The raw resource id (R.raw.something) for the resource

  • audioFileUsage:

    AudioFileUsage

    Audio file usage mode

Methods

play

Copy URL
fun play(loop: 

Boolean

):

Unit

This API is in beta and subject to change.

Starts playing an audio file.

Parameters

  • loop:

    Boolean

    Whether to loop the audio file

Returns

  • type:

    Unit

stop

Copy URL
fun stop(pause: 

Boolean

):

Unit

This API is in beta and subject to change.

Stops or pauses playing an audio file.

If the file is paused, it is possible to continue to play it by calling AudioFile.play from the position it has been stopped.

Parameters

  • pause:

    Boolean

    Whether to pause the audio file

Returns

  • type:

    Unit

release

Copy URL
fun release(): 

Unit

This API is in beta and subject to change.

Releases all resources allocated for playing audio file.

Must be called even if the file is not played.

Returns

  • type:

    Unit

Props

listener

Copy URL
var listener: 

AudioFileListener?

This API is in beta and subject to change.

Registers a listener to be notified about events regarding audio file playing status.

Returns