Przeglądaj źródła

Added onfinished callback; close #7

Dominic Szablewski 12 lat temu
rodzic
commit
43c8a3ddc4
1 zmienionych plików z 5 dodań i 0 usunięć
  1. 5 0
      jsmpg.js

+ 5 - 0
jsmpg.js Wyświetl plik

32
 	this.loop = !!opts.loop;
32
 	this.loop = !!opts.loop;
33
 	this.externalLoadCallback = opts.onload || null;
33
 	this.externalLoadCallback = opts.onload || null;
34
 	this.externalDecodeCallback = opts.ondecodeframe || null;
34
 	this.externalDecodeCallback = opts.ondecodeframe || null;
35
+	this.externalFinishedCallback = opts.onfinished || null;
35
 	this.bwFilter = opts.bwFilter || false;
36
 	this.bwFilter = opts.bwFilter || false;
36
 
37
 
37
 	this.customIntraQuantMatrix = new Uint8Array(64);
38
 	this.customIntraQuantMatrix = new Uint8Array(64);
388
 		else if( code == BitReader.NOT_FOUND ) {
389
 		else if( code == BitReader.NOT_FOUND ) {
389
 			this.stop(); // Jump back to the beginning
390
 			this.stop(); // Jump back to the beginning
390
 
391
 
392
+			if( this.this.externalFinishedCallback ) {
393
+				this.externalFinishedCallback(this);
394
+			}
395
+
391
 			// Only loop if we found a sequence header
396
 			// Only loop if we found a sequence header
392
 			if( this.loop && this.sequenceStarted ) {
397
 			if( this.loop && this.sequenceStarted ) {
393
 				this.play();
398
 				this.play();