Guidance
指路人
g.yi.org
software / rapidq / Examples / Audio & Video / skin / Player.bas

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
     $TYPECHECK ON
     $OPTIMIZE ON
     $INCLUDE "Rapidq.inc"
     $INCLUDE "QFuncLib.inc"
     $INCLUDE "Object\QSkin.inc"
     $INCLUDE "Object\QSkinBtn.inc"
     $INCLUDE "Object\QTextBtn.inc"
     $INCLUDE "Object\QFlashLabel.inc"
     $INCLUDE "Object\QVuMeter.inc"
     $INCLUDE "Object\QVideo.inc"

     $RESOURCE img AS "skin3.bmp" ' fichier bitmap d'habillage
     $RESOURCE play1 AS "play1.bmp"
     $RESOURCE play2 AS "play2.bmp"
     $RESOURCE stop1 AS "stop1.bmp"
     $RESOURCE stop2 AS "stop2.bmp"
     $RESOURCE pause1 AS "pause1.bmp"
     $RESOURCE pause2 AS "pause2.bmp"
     $RESOURCE back1 AS "back1.bmp"
     $RESOURCE back2 AS "back2.bmp"
     $RESOURCE fwd1 AS "foreward1.bmp"
     $RESOURCE fwd2 AS "foreward2.bmp"
     $RESOURCE power1 AS "power1.bmp"
     $RESOURCE power2 AS "power2.bmp"

     DECLARE SUB quit
     DECLARE SUB volume
     DECLARE SUB SetVolume
     DECLARE SUB OPEN
     DECLARE SUB play
     DECLARE SUB stop
     DECLARE SUB foreward
     DECLARE SUB backward
     DECLARE SUB pause
     DECLARE SUB ShowTime(Position AS LONG,timePos AS LONG)

     CONST color1=&h660000
     CONST color2=&hff9900
     CONST color3=&h88FF66
     CONST RazClock="00:00"

     DIM OpenDialog AS QOPENDIALOG
     OpenDialog.Filter="Fichier vidéo(tout type)|*.avi;*.mpg;*.mpeg;*.mov|Fichier avi|*.avi|Fichier MPEG|*.mpg;*.mpeg|Fichier MOV|*.mov|"
     OpenDialog.CAPTION= "Selectionner une vidéo"

     CREATE Form AS QSkin
      Center
      skin.bmpHandle=img 'affectation du bitmap d'habillage
      skin.top=-1 ' offset de position du bitmap
      skin.left=-1 ' offset de position du bitmap
      CAPTION="Player"
      OffsWidth=-5
      CREATE display AS QPANEL
       top=20
       left=16
       width=311
       height=72
       bevelinner=0
       bevelouter=0
       COLOR=&h994400
       CREATE bar AS QPANEL
        top=50
        left=0
        width=display.width
        height=2
        bevelinner=0
        bevelouter=0
        COLOR=color1
       END CREATE
       CREATE FlashPlay AS QFlashlabel
        DarkColor=color1
        LightColor=color3
        left=5
        top=2
        CAPTION="Play"
       END CREATE
       CREATE FlashStop AS QFlashlabel
        DarkColor=color1
        LightColor=color3
        left=5
        top=16
        CAPTION="Stop"
        state=true
       END CREATE
       CREATE FlashPause AS QFlashlabel
        DarkColor=color1
        LightColor=color3
        left=5
        top=30
        CAPTION="Pause"
       END CREATE
       CREATE FlashTime AS QFlashlabel
        DarkColor=color1
        LightColor=color2
        left=150
        top=6
        font.size=24
        CAPTION=RazClock
        State=true
       END CREATE
       CREATE vu AS QVuMeter
        top=1
        left=290
        width=10
        height=45
        DarkColor=color1
        LightColor=color2
        value=50
       END CREATE
       CREATE btOpen AS QTextBtn
        UpColor=color1
        DownColor=color2
        left=5
        top=55
        font.bold=true
        CAPTION="Open"
        OnClick=OPEN
       END CREATE
       CREATE btVol AS QTextBtn
        UpColor=color1
        DownColor=color2
        left=265
        top=55
        font.bold=true
        CAPTION="Volume"
        OnClick=Volume
       END CREATE
      END CREATE
      CREATE btPlay AS QskinBtn
       btUp.bmphandle=play1
       btDown.bmphandle=play2
       top=110
       left=12
       mode=1
       OnClick=play
      END CREATE
      CREATE btStop AS QskinBtn
       btUp.bmphandle=stop1
       btDown.bmphandle=stop2
       top=110
       left=44
       OnClick=stop
      END CREATE
      CREATE btPause AS QskinBtn
       btUp.bmphandle=pause1
       btDown.bmphandle=pause2
       top=110
       left=76
       mode=1
       OnClick=pause
      END CREATE
      CREATE btBack AS QskinBtn
       btUp.bmphandle=back1
       btDown.bmphandle=back2
       top=110
       left=108
       OnClick=backward
      END CREATE
      CREATE btFwd AS QskinBtn
       btUp.bmphandle=fwd1
       btDown.bmphandle=fwd2
       top=110
       left=140
       OnClick=foreward
      END CREATE
      CREATE btPower AS QskinBtn
       btUp.bmphandle=power1
       btDown.bmphandle=power2
       top=110
       left=300
       OnClick=quit
      END CREATE
     END CREATE

     CREATE Form2 AS QFORM
      CAPTION="Volume"
      Width=60
      Height=190
      Center
      borderStyle=bsToolWindow
      CREATE TbVol AS QTRACKBAR
       cursor=crHandPoint
       Orientation=tbVertical
       Frequency=5
       TickMarks=tmBoth
       TickStyle=tsAuto
       Left=5
       Top=5
       Max=0
       Min=-100
       Width=45
       Height=150
       position=-50
       OnChange=SetVolume
      END CREATE
     END CREATE

     CREATE video AS QVideo
      PARENT=0
      volume=50
      OnChange=ShowTime
      TIMER.interval=200
      BorderStyle=bsSizeable
     END CREATE

     form.shapeform(img,&hffffff) ' affectation de la forme
     form.setdeskbar
     Form.SHOWMODAL

     SUB quit
      video.CLOSE
      form2.CLOSE
      application.terminate
     END SUB

     SUB volume
      form2.show
     END SUB

     SUB SetVolume
      vu.value=ABS(TbVol.position)
      video.volume=ABS(TbVol.position)
     END SUB

     SUB OPEN
      IF OpenDialog.EXECUTE THEN
       video.CLOSE
       IF video.OPEN(OpenDialog.FileName) THEN
        btPlay.down=false
        FlashPlay.state=false
        FlashStop.state=true
        btPause.Down=false
        FlashPause.flash=false
        FlashTime.CAPTION=RazClock
        video.CAPTION=GetFileName(OpenDialog.FileName)
       ELSE
        SHOWMESSAGE video.ERROR
       END IF
      END IF
     END SUB

     SUB play
      IF video.FileOpen=false THEN
       btPlay.Down=false
      ELSE
       FlashPause.flash=false
       FlashStop.state=false
       FlashPlay.state=true
       btPause.Down=false
       video.play
      END IF
     END SUB

     SUB stop
      video.stop
      btPlay.down=false
      FlashPlay.state=false
      FlashStop.state=true
      btPause.Down=false
      FlashPause.flash=false
      FlashTime.CAPTION=RazClock
     END SUB

     FUNCTION GetMinutes(seconds AS LONG) AS STRING
      DIM min AS INTEGER
      DIM sec AS INTEGER
      DIM sMin AS STRING
      DIM sSec AS STRING

      min=seconds/60
      sec=seconds MOD 60
      IF min<10 THEN
       sMin="0"+STR$(min)
      ELSE
       sMin=STR$(min)
      END IF
      IF sec<10 THEN
       sSec="0"+STR$(sec)
      ELSE
       sSec=STR$(sec)
      END IF
      result=sMin+":"+sSec
     END FUNCTION

     SUB ShowTime(Position AS LONG,timePos AS LONG)
      FlashTime.CAPTION=GetMinutes(timePos)
      IF Video.State=VD_STOP THEN
       btPlay.down=false
       FlashPlay.state=false
       FlashStop.state=true
      END IF
     END SUB

     SUB pause
      IF video.state=VD_PLAY THEN
       video.pause
       btPlay.down=false
       FlashPlay.state=false
       FlashPause.flash=true
      ELSE
       IF video.FileOpen=false THEN btPause.Down=false
      END IF
     END SUB

     SUB foreward
      IF (video.currentFrame+1)<video.lenght THEN
       video.currentFrame=video.currentFrame+1
       FlashTime.CAPTION=STR$(video.currentFrame)
      END IF
     END SUB

     SUB backward
      IF video.currentFrame>0 THEN
       video.currentFrame=video.currentFrame-1
       FlashTime.CAPTION=STR$(video.currentFrame)
      END IF
     END SUB

掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2019-4-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-09-18 19:22:40