getStatus

 

The follow displays the data contained in the returned object

Field Description
enabled Overall player is active or inactive. 0=disabled, 1 = enabled.
init Indicates if the file is ready and loading properly. 0 = preparing, 1=ready for playback

status Indicates if there is a file available for playback in the player.

activity

Three kinds of activity are available:
-1 = No activity. Player is not playing anything.
0 = Thinking (loading started but not enough data to play)
1 = Player is playing.

playing Playing/paused/stopped 0 = paused/stopped, 1 = playing
percent Percentage played as derived from current playhead position / total duration*.

*duration Duration of the track in seconds. NOTE: May be an estimate based on file size if file not completely loaded and/or no meta-data exists, and/or platform doesn't have duration determination capabilities.

duration_nice Duration of the track, nicely formatted. (e.g. 3:16)

remaining Time remaining in seconds.

remaining_nice Time remaining, nicely formatted. (e.g. 23:12)

current Current time in seconds.

current_nice Current time, nicely formatted. (e.g. 23:12)

 

getStatus()

 

Parameters

none

 

Return Value

object

Returns an object containing general info related to the track's state and time signatures.

 

See Also

 

Examples


<!-- Results will appear within this DIV -->
<div id="showStatusID"></div>

<!-- Wimpy Player Instance -->
<div id="myPlayerID" data-wimpyplayer></div>

<script>

// Place variables here on the window so all functions have access to them.

var player;
var statusView;

function pollPlayer(){
	
	var info = player.getStatus();
	
	var displayText = "";
	displayText += "Enabled: " 		+ info.enabled 		+ "<br/>";
	displayText += "Initialized: " 	+ info.init 		+ "<br/>";
	displayText += "Status: " 		+ info.status 		+ "<br/>";
	displayText += "Activity: " 	+ info.activity 	+ "<br/>";
	displayText += "Playing: " 		+ info.playing 		+ "<br/>";
	displayText += "Percent: " 		+ info.percent 		+ "<br/>";
	displayText += "Duration Nice: " 	+ info.duration_nice 	+ " Raw Seconds: " + info.duration 	+ "<br/>";
	displayText += "Remaining Nice: " 	+ info.remaining_nice 	+ " Raw Seconds: " + info.remaining + "<br/>";
	displayText += "Current Nice: " 	+ info.current_nice 	+ " Raw Seconds: " + info.current 	+ "<br/>";
	
	statusView.innerHTML = displayText;

}

function setup(){

	// Get a handle to the player that has the DIV id set to "myPlayerID"
	player = wimpy.getPlayer("myPlayerID");

	// Get a handle to the DIV we're using to report the values.
	statusView = document.getElementById("showStatusID");

	// Set up a ticker to retrieve the values at regular intervals.
	// poll every 500 milliseconds (1/2 seconds)
	setInterval(pollPlayer, 500); 

}

// Call our setup function when wimpy is ready. If we don't wait 
// until wimpy has set up all the players, we'll get errors.
wimpy.onReady(setup);


</script>