Jump to content

How to fun video faster/slower ?


Recommended Posts

Hello,

I need some help from you, thanks to DSEngine.au3 that I can make the Video Player :

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SliderConstants.au3>
#include <DSEngine.au3>

Global $MovieGUI, $VideoPlay, $VideoStop, $VideoOpen, $VideoPos, $VideoVol, $ViewerVideo
Global $mVol, $mLength, $mVideoPlaying

$MovieGUI = GUICreate("Movie Player", 740, 590, -1, -1, -1)
$VideoPlay = GUICtrlCreateButton("PLAY", 20, 520, 100, 50)
$VideoStop = GUICtrlCreateButton("STOP", 140, 520, 100, 50)
$VideoOpen = GUICtrlCreateButton("OPEN", 260, 520, 100, 50)
$VideoSlow = GUICtrlCreateButton("SLOW", 380, 520, 100, 50)
$VideoSpeed = GUICtrlCreateButton("SPEED", 500, 520, 100, 50)
$VideoPos = GUICtrlCreateSlider(20, 490, 660, 25, $TBS_ENABLESELRANGE)
$ViewerVideo = GUICreate("", 660, 400, 20, 70, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_DISABLED, $WS_EX_MDICHILD), $MovieGUI)
GUISetState(@SW_SHOW, $ViewerVideo)
GUISetBkColor(0x00000, $ViewerVideo)
WinSetTrans($ViewerVideo, "", 220)
Global $mVol = GUICtrlRead($VideoVol)
GUISetState(@SW_SHOW, $MovieGUI)

While 1
$MSG = GUIGetMsg()
Switch $MSG
Case $GUI_EVENT_CLOSE
Exit
Case $VideoOpen
$PathVideo = FileOpenDialog("Open Video", "", "All Video(*.Avi;*.Wmp;*.Mkv;*.Flv;*.Mp4;*.Mpg;*.Ts)|All File(*.*)|Video(*.Avi; *.Wmp)", 1 + 4)
PlayVideo($PathVideo)
EndSwitch

If $mVideoPlaying = True Then
;
Switch $MSG
Case $VideoStop
Engine_StopPlayback()
GUICtrlSetData($VideoPos, Engine_GetLength())
GUISetBkColor(0x00000, $ViewerVideo)
WinSetTrans($ViewerVideo, "", 220)
Case $VideoPlay
Switch GUICtrlRead($VideoPlay)
Case "PLAY"
Engine_PausePlayback()
GUICtrlSetData($VideoPlay, "PAUSE")
Case "PAUSE"
Engine_StartPlayback()
GUICtrlSetData($VideoPlay, "PLAY")
EndSwitch
Case $VideoSpeed
;~ => I think that is a bad idea : <lag>

;~  For $n = 1 To $mLength Step 1
;~  If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
;~  Engine_SetPosition(Engine_GetPosition() + 0.5)
;~  Sleep(2)
;~  Next
Case $VideoSlow
; I do not have any idea for this
EndSwitch
;
$mGGCI = GUIGetCursorInfo($MovieGUI)
If IsArray($mGGCI) And $mGGCI[4] = $VideoPos And $mGGCI[2] = 1 Then
While $mGGCI[2]
$mGGCI = GUIGetCursorInfo($MovieGUI)
$mPos = GUICtrlRead($VideoPos)
Sleep(1)
WEnd
Engine_SetPosition($mPos)
EndIf

GUICtrlSetData($VideoPos, Engine_GetPosition())
EndIf
WEnd

Func PlayVideo($SavePath)
If $SavePath <> "" Then
Engine_LoadFile($SavePath, $ViewerVideo)
Engine_StartPlayback()
$mLength = Engine_GetLength()
GUICtrlSetLimit($VideoPos, $mLength, 0)
$mVideoPlaying = True
EndIf
EndFunc   ;==>PlayVideo

I can Stop, Pause, Resum video easily but I can't play video in fast (slow) mode like Increase Speed (Slow) button in Media player Classic. So could you tell me how to do this ? An example is very important to me. All answers are welcome

Thank you so much !

Edited by MrVietA2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...