diff --git a/playem-audiofile.js b/playem-audiofile.js
index <HASH>..<HASH> 100644
--- a/playem-audiofile.js
+++ b/playem-audiofile.js
@@ -107,7 +107,7 @@ function AudioFilePlayer(){
 	};
 	
 	Player.prototype.setTrackPosition = function(pos) {
-		this.widget && this.widget.setPosition(pos * 1000);
+		this.widget && this.widget.setPosition(Math.floor(Math.min(this.widget.duration, pos * 1000) - 2000));
 	};
 	
 	Player.prototype.embed = function(vars) {
in order to avoid receiving onEnd event too early: can only seek 2 seconds before end of loaded stream