summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/media9/files/players/APlayer.mxml
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-06-27 22:03:47 +0000
committerKarl Berry <karl@freefriends.org>2014-06-27 22:03:47 +0000
commit502b3247f7162d722b01b5f0cb89f6c27c12256d (patch)
tree9802be30691b917dfecdcb960443861bad2053ce /Master/texmf-dist/doc/latex/media9/files/players/APlayer.mxml
parent0ae0c71bf90569f76d7ea67432cee361f79e7593 (diff)
media9 (27jun14)
git-svn-id: svn://tug.org/texlive/trunk@34456 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/media9/files/players/APlayer.mxml')
-rw-r--r--Master/texmf-dist/doc/latex/media9/files/players/APlayer.mxml54
1 files changed, 34 insertions, 20 deletions
diff --git a/Master/texmf-dist/doc/latex/media9/files/players/APlayer.mxml b/Master/texmf-dist/doc/latex/media9/files/players/APlayer.mxml
index 78503bc4695..30ae5de9229 100644
--- a/Master/texmf-dist/doc/latex/media9/files/players/APlayer.mxml
+++ b/Master/texmf-dist/doc/latex/media9/files/players/APlayer.mxml
@@ -4,7 +4,7 @@
<!-- a FlashPlayer-10 compatible component for playing -->
<!-- MP3 audio files and streams. -->
<!-- -->
-<!-- version 20140211 -->
+<!-- version 20140625 -->
<!-- -->
<!-- -->
<!-- The free Apache Flex 4 SDK is required to compile -->
@@ -64,7 +64,9 @@
private var id3:ID3Info;
private var sndCh:SoundChannel;
private var sndTr:SoundTransform;
- private var playResumePosition:Number = 0;
+ private var playResumePos:Number = 0;
+ private var pauseAtPos:Number = -1;
+ private var toBePaused:Boolean = false;
private var plyng:Boolean = false;
private var muted:Boolean = false;
private var lastVol:Number;
@@ -117,12 +119,12 @@
break;
case 36: //home
pause();
- playResumePosition=(0);
+ playResumePos=(0);
break;
case 35: //end
if(playProgress.indeterminate) break;
pause();
- playResumePosition=(snd.length);
+ playResumePos=(snd.length);
break;
case 37: //<--
fadeEffect.end();
@@ -137,11 +139,11 @@
if(plyng)
curTime=sndCh.position;
else
- curTime=playResumePosition;
+ curTime=playResumePos;
}
keyPressed=true;
- playResumePosition=Math.max(0,curTime-deltaSeek);
- if(plyng) seek(playResumePosition/1000);
+ playResumePos=Math.max(0,curTime-deltaSeek);
+ if(plyng) seek(playResumePos/1000);
deltaSeek*=1.1;
break;
case 39: //-->
@@ -157,11 +159,11 @@
if(plyng)
curTime=sndCh.position;
else
- curTime=playResumePosition;
+ curTime=playResumePos;
}
keyPressed=true;
- playResumePosition=Math.min(snd.length-10,curTime+deltaSeek);
- seek(playResumePosition/1000);
+ playResumePos=Math.min(snd.length-10,curTime+deltaSeek);
+ seek(playResumePos/1000);
deltaSeek*=1.1;
break;
case 38:
@@ -233,17 +235,19 @@
private function loadPolicy(p:String):void {policy=p;}
- private function play():void {
+ private function play(p:Number=-1):void {
+ if(p>=0) seek(p);
if(plyng) return;
- try{sndCh = snd.play(playResumePosition, 0, sndTr);}
+ try{sndCh = snd.play(playResumePos, 0, sndTr);}
catch(e:Error){Alert.show(e.message,'Error');}
sndCh.addEventListener(Event.SOUND_COMPLETE, onSoundComplete);
plyng = true;
}
- private function pause():void {
+ private function pause(p:Number=-1):void {
+ if(p>=0){pauseAtPos=p*1000;return;}
if(!plyng) return;
- playResumePosition = sndCh.position;
+ playResumePos = sndCh.position;
sndCh.stop();
plyng = false;
}
@@ -253,7 +257,7 @@
}
private function seek(p:Number):void {
- playResumePosition = p*1000;
+ playResumePos = p*1000;
if(!plyng) return;
sndCh.stop();
plyng = false;
@@ -288,7 +292,7 @@
}
private function currentTime():Number {
- return sndCh.position/1000;
+ return sndCh.position/1000;
}
private function playing():Boolean {
@@ -322,7 +326,7 @@
private function onSoundComplete(e:Event):void {
plyng = false;
- playResumePosition = 0;
+ playResumePos = 0;
if(loop) play();
}
@@ -340,8 +344,8 @@
playProgress.setProgress(sndCh.position,snd.length);
caption.text=formatLabel(sndCh.position);
} else {
- playProgress.setProgress(playResumePosition,snd.length);
- caption.text=formatLabel(playResumePosition);
+ playProgress.setProgress(playResumePos,snd.length);
+ caption.text=formatLabel(playResumePos);
}
}else{
if(plyng) {
@@ -349,9 +353,19 @@
caption.text=formatLabel(sndCh.position);
} else {
playProgress.setProgress(snd.bytesLoaded,snd.bytesTotal);
- caption.text=formatLabel(playResumePosition);
+ caption.text=formatLabel(playResumePos);
}
}
+ if(plyng&&pauseAtPos>=0&&sndCh.position<pauseAtPos)
+ toBePaused=true;
+ if(
+ plyng&&pauseAtPos>=0&&
+ sndCh.position>=pauseAtPos&&toBePaused
+ ){
+ pause();
+ pauseAtPos=-1;
+ toBePaused=false;
+ }
}
private function onID3Info(e:Event):void {id3 = e.target.id3;}