TSAudioPlayer Class

Constructors

  Name Description
TSAudioPlayer() Initializes new instance of the TSAudioPlayer class

TSAudioPlayer Properties

  Name Description
bool SetLoop Get/Set MediaFile Loop

TSAudioPlayer Properties

  Name Description
string Status(string alias) Returns the current status player: playing, paused, stopped, etc.
long GetFileDuration(string alias) Returns total MediaFile duration in millieseconds
long GetCurrentMilisecond(string alias) Returns current miliseconds AudioFile played
bool IsPlaying(string alias) Returns value if MediaFile is playing

TSAudioPlayer Methods

  Name Description
void Open(string filePath, string alias, bool waveFile) Open MediaFile
void Close(string alias) Close MediaFile
void Play(bool loopAudio, string alias, bool closeAfterPlay) Play MediaFile
void Pause(string alias) Pause MediaFile
void Resume(string alias) Resume MediaFile
void Stop(string alias) Stop MediaFile
void SetPosition(string alias, long millieseconds) Set new playing positions of MediaFile
void Volume(string alias, long value) Change the volume of MediaFile

TSAudioPlayer Code Example

 
  // the audioTag specifies which audio stream you want to control
  // you can use multiple audioTag(s) to create multiple audio streams 
  string audioTag = "myMediaApp";

  // create & initialize IconFileReader
  TSAudioPlayer audioPlayer = new TSAudioPlayer();

  // open audio file from drive
  audioPlayer.Open("C:\\Users\\Thoosje\\Music\\song.mp3", audioTag, false);

  // play audio (loop=false, alias=audioTag, closeAfterPlayer=false)
  audioPlayer.Play(false, audioTag);

  // pause audio
  audioPlayer.Pause(audioTag);

  // resume audio
  audioPlayer.Resume(audioTag);

  // set audio playing position at 15 seconds
  audioPlayer.SetPosition(audioTag, 15000);

  // set audio volume (0 to 1000)
  audioPlayer.Volume(audioTag, 1000);

  // stop audio player
  audioPlayer.Stop(audioTag);

  // close audio stream belonging to audioTag
  audioPlayer.Close(audioTag);