Rate this page:

AudioFile

Constructors

AudioFile

Copy URL
fun AudioFile(resId: 

Int

,
audioFileUsage:

AudioFileUsage

):

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

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

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

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?

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

Returns