// Bugfixes for JW Silverlight Player version 1.1
// ============================================================================================================

// Date: 07.06.2011
// Description:
//     When pressing pause, following error message is thrown repeatedly:
//         Bad NPObject as private data!
//         Source file: wmvplayer.js
//         Line: 756
//     This leads to a memory leak, that eventually will crash the browser.
//     The problem is that an interval (started by playing, buffering and opening) doesn't get cleared
//     properly on pause. this bugfix overwrites the timeChanged method of the player and clears
//     the interval on exception.
// 
// Solution found on:
//     http://www.longtailvideo.com/support/forums/jw-player/bug-reports/10320/bad-npobject-as-private-data
// ============================================================================================================
jeroenwijering.Model.prototype.timeChanged = function () {
	try {
		var pos = Math.round(this.video.Position.Seconds * 10) / 10;
		this.view.onTime(pos, this.configuration['duration']);
	} catch (ex) {
		clearInterval(this.timeint);
	}
};

// Date: 06.07.2011
// Description:
//     When pausing a live wmv stream, the player begins an infinite loop and it's not possible to
//     restart streaming anymore.
// 
// Solution found on:
//     http://www.longtailvideo.com/support/forums/jw-player/bug-reports/11628/silverlight-4
// ============================================================================================================
jeroenwijering.Model.prototype.goStop = function () {
	this.video.Visibility = 'Collapsed';
	this.preview.Visibility = 'Visible';
	this.goPause(0);
	this.video.stop();
	this.view.onBuffer(0);
	clearInterval(this.timeint);
}

