Skip to content

Commit

Permalink
The destroy() now does a clearMedia. This stops downloads from stream…
Browse files Browse the repository at this point in the history
…s persiting on some browsers.
  • Loading branch information
thepag committed Aug 7, 2011
1 parent e998241 commit d45a18c
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions jquery.jplayer/jquery.jplayer.js
Expand Up @@ -8,7 +8,7 @@
* - http://www.gnu.org/copyleft/gpl.html
*
* Author: Mark J Panaghiston
* Version: 2.0.26
* Version: 2.0.27
* Date: 7th August 2011
*/

Expand Down Expand Up @@ -232,7 +232,7 @@
$.jPlayer.prototype = {
count: 0, // Static Variable: Change it via prototype.
version: { // Static Object
script: "2.0.26",
script: "2.0.27",
needFlash: "2.0.26",
flash: "unknown"
},
Expand Down Expand Up @@ -758,28 +758,26 @@
// MJP: The background change remains. Would need to store the original to restore it correctly.
// MJP: The jPlayer element's size change remains.

// Reset the interface, remove seeking effect and times.
this._resetStatus();
this._updateInterface();
this._seeked();
// Clear the media to reset the GUI and stop any downloads. Streams on some browsers had persited. (Chrome)
this.clearMedia();
// Remove the size/sizeFull cssClass from the cssSelectorAncestor
this._removeUiClass();
// Remove the times from the GUI
if(this.css.jq.currentTime.length) {
this.css.jq.currentTime.text("");
}
if(this.css.jq.duration.length) {
this.css.jq.duration.text("");
}

if(this.status.srcSet) { // Or you get a bogus error event
this.pause(); // Pauses the media and clears any delayed commands used in the HTML solution.
}
$.each(this.css.jq, function(fn, jq) { // Remove any bindings from the interface controls.
// Remove any bindings from the interface controls.
$.each(this.css.jq, function(fn, jq) {
// Check selector is valid before trying to execute method.
if(jq.length) {
jq.unbind(".jPlayer");
}
});
if( this.options.emulateHtml ) {
// Destroy the HTML bridge.
if(this.options.emulateHtml) {
this._destroyHtmlBridge();
}
this.element.removeData("jPlayer"); // Remove jPlayer data
Expand Down Expand Up @@ -1233,19 +1231,16 @@
var self = this,
supported = false;

this._seeked();
clearTimeout(this.internal.htmlDlyCmdId); // Clears any delayed commands used in the HTML solution.
this._resetMedia();
this._resetGate();
this._resetActive();

$.each(this.formats, function(formatPriority, format) {
var isVideo = self.format[format].media === 'video';
$.each(self.solutions, function(solutionPriority, solution) {
if(self[solution].support[format] && self._validString(media[format])) { // Format supported in solution and url given for format.
var isHtml = solution === 'html';

self._resetMedia();
self._resetGate();
self._resetActive();

if(isVideo) {
if(isHtml) {
self.html.video.gate = true;
Expand Down Expand Up @@ -1304,9 +1299,6 @@
this._updateButtons(false);
this._updateInterface();
} else { // jPlayer cannot support any formats provided in this browser
this._resetMedia();
this._resetGate();
this._resetActive();
// Send an error event
this._error( {
type: $.jPlayer.error.NO_SUPPORT,
Expand All @@ -1320,6 +1312,7 @@
this._resetStatus();
this._updateButtons(false);
this._updateInterface();
this._seeked();
this.internal.poster.jq.hide();

clearTimeout(this.internal.htmlDlyCmdId);
Expand Down

0 comments on commit d45a18c

Please sign in to comment.