It is currently 5. June 2020 00:28

All times are UTC + 1 hour




 Page 1 of 1 [ 1 post ] 
Author Message
 Post subject: Simple Media Player
PostPosted: 23. August 2009 15:54 
Administrator
User avatar

Joined: 17. March 2008 13:32
Posts: 96
Location: Arnstadt, Germany
Supports everything that windows media player could play
Requires MCI.DLL
;; Simple Media Player (or something like it ;))
;; Usage /player [filename]
;; Trackbar is fully working
;; Spacebare pauses the player (while window is active)
;; Movie gets paused while moving
;; Playerwindow closes when playback is finished
;; Double click into player window closes the window and stops the playback
alias mci if ($1- = close vid) { !.timermcipos off } | return $dll(mci.dll,MCIString,$1-)
alias player {
  if ($window(@MCIPlayer)) {
    mci close vid
    window -c @MCIPlayer
  }
  if ($isfile($shortfn($1-))) {
    if ($istok(avi divx mpeg mpg wmv mp4,$gettok($1-,-1,46),32)) {
      set %lastviddir $nofile($shortfn($1-))
      mci open $shortfn($1-) type mpegvideo alias vid
      mci where vid destination max
      tokenize 32 $result
      !window -Bhpdk0o +d @MCIPlayer -1 -1 $4 $calc($5 +5)
      titlebar @MCIPlayer playing
      mciposupdate 1
      mci window vid handle [ $window(@MCIPlayer).hwnd ]
      mci play vid
      mci set vid time format ms
      mci status vid volume 255
      mci status vid length
      !.timermcipos -m 0 100 mciposupdate $gettok($result,2,32)
    }
    else {
      echo $color(info) -ag * Please open only files with the extensions: avi, divx, mpeg, mpg, wmv, mp4
    }
  }
  elseif (!$len($1)) {
    var %x $shortfn($$sfile(%lastviddir *.avi;*.divx;*.mpeg;*.mpg;*.wmv;*.mp4,Open Video,Open))
    .timer -m 1 1 player $iif(%x,%x)
  }
  else {
    echo $color(info) -ag * Please use: /player [filename] - If you specify a filename the file must exists!
  }
}
on *:unload:{
  unset %lastviddir
}
alias mciposupdate {
  mci status vid position
  drawrect -fr @mciplayer 0 0 0 $calc($window(@mciplayer).h - 5) $window(@mciplayer).w 5
  drawline -r @mciplayer 16777215 1 0 $calc($window(@mciplayer).h - 5) $window(@mciplayer).w $calc($window(@mciplayer).h - 5)
  drawline -r @mciplayer 16777215 1 0 $calc($window(@mciplayer).h - 5) 0 $window(@mciplayer).h
  drawline -r @mciplayer 5263440 1 0 $calc($window(@mciplayer).h -1) $calc($window(@mciplayer).w -1) $calc($window(@mciplayer).h -1) $calc($window(@mciplayer).w -1) $calc($window(@mciplayer).h - 5)
  drawrect -fr @mciplayer $rgb(255,127,127) 0 1 $calc($window(@mciplayer).h -4) $ceil($calc(($gettok($result,2,32) / $1) * ($window(@mciplayer).w -2))) 3
  if ($gettok($result,2,32) == $1) {
    mci close vid
    window -c @mciplayer
    echo $color(info) -ag * Simple Media Player closed. (Video Finished)
  }
}
menu @MCIPlayer {
  sclick:{
    if ($mouse.y isnum $+($calc($window(@mciplayer).h -4),-,$calc($window(@mciplayer).h -1))) && ($mouse.x isnum $+(2-,$calc($window(@mciplayer).w -2))) {
      mci status vid length
      var %l = $gettok($result,2,32)
      mci play vid from $ceil($calc(%l / ($window(@mciplayer).w -2) * $mouse.x))
      mciposupdate %l
    }
    else {
      !set %playerMove $mouse.x $mouse.y | if ($wt != paused) { mci pause vid }
    }   
  }
  uclick:!unset %playerMove | if ($wt != paused) { mci resume vid }
  mouse:{
    if (%playerMove && $mouse.key & 1) {
      !.timermoveplayer -m 1 15 window $active $&
        $calc($mouse.dx - $gettok(%playerMove,1,32)) $&
        $calc($mouse.dy - $gettok(%playerMove,2,32)) $&
        $window($active).w $window($active).h
    }
  }
  dclick:{
    mci close vid
    window -c @MCIPlayer
  }
}
alias -l wt { return $window(@mciplayer).title }
on *:KEYDOWN:@MCIPlayer:32:{
  if ($wt = paused) {
    mci resume vid
    titlebar @mciplayer playing
  }
  else {
    mci pause vid
    titlebar @mciplayer paused
  }
}
on *:close:@MCIPlayer:{ mci close vid }


Image



_________________
one step closer to world domination
Cyberscripters Administrator/Founder
Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

cron