MediaPlayer object

From StealthBot Wiki
Jump to: navigation, search

The MediaPlayer object allows you to control a media player using StealthBot scripting. You cannot change the media player StealthBot is interacting with using scripting. This object is a polymorphic object for all current and future media players that StealthBot supports.

Supported media players:


This object was added in StealthBot version 2.7 by Eric to create an object-oriented experience in scripting.

How to use

Example: Count how many songs you have in your playlist.

Value = MediaPlayer.PlaylistCount

Example: Playing a track by number.

Value = MediaPlayer.PlayTrack(142)


List of properties

Name property

Returns a string, either "Winamp" or "iTunes", describing the current media player loaded.

Volume property

Sets or returns the current sound volume as a number from 0 to 100.

PlaylistPosition property

Returns the current numeric position in the current playlist.

PlaylistCount property

Returns the number of tracks in the current playlist.

TrackName property

Returns the name of the current track.

TrackLength property

Returns the length in seconds of the current track.

Shuffle property

Sets or returns whether the media player is currently "shuffling" the track list (random next song).

Repeat property

Sets or returns whether the media player will "repeat" the playlist once it has completed all songs.

IsPlaying property

Returns whether the media player is playing. will return false if the media player is not laoded.

IsPaused property

Returns whether the media player is paused. Will return false if no media is loaded or the media player is not loaded.

Public Function IsLoaded() As Boolean Public Function Start(Optional filePath As String) As Boolean Public Sub NextTrack() Public Sub PreviousTrack() Public Sub PlayTrack(Optional ByVal Track As Variant = vbNullString) Public Sub PausePlayback() Public Sub QuitPlayback() Public Sub FadeOutToStop()


List of functions

IsLoaded function

Attempts to load the media player if not loaded. Returns true on success or already loaded and false on failure.

Start function

Attempts to load the media player from a specific location (if provided) or from the default install location for that media player (if not provided).

NextTrack function

Moves to the next track to play.

PreviousTrack function

Moves to the previous track to play.

PlayTrack function

Attempts to play a different track by name. The track must be in the current playlist. If no track name or number is provided, this function will just begin playback.

PausePlayback function

Pauses the current playback. .PlayTrack() with no arguments resumes playback.

QuitPlayback function

Stops the current playback. .PlayTrack() with no arguments restarts playback.

FadeOutToStop function

Causes the media player to fade-out stop. Similar to calling .QuitPlayback() but arguably better sounding.

iTunes does not support fade-out stopping so this method will just stop playback.

See also