Hallo,
wie kann ich mit AutoIt WMA-Streams abspielen?
Hallo,
wie kann ich mit AutoIt WMA-Streams abspielen?
damit müsste es gehen.... Ungetestet !
Global $oPlayer1 = ObjCreate("WMPlayer.OCX")
Global $oPlayer2 = ObjCreate("WMPlayer.OCX")
$song1 = @ScriptDir & "\test1.mp3" ; requires full path name ...
$song2 = @ScriptDir & "\test2.mp3" ; requires full path name ...
$rc = WMLoadFile($oPlayer1, $song1)
MsgBox(0, "1 rc", $rc)
$rc = WMLoadFile($oPlayer2, $song2)
MsgBox(0, "2 rc", $rc)
$rc = WMGetDuration($oPlayer1);
MsgBox(0, "2 rc", $rc)
; turns the volume down and back up slowly... song 1
For $i = 100 To 0 Step -1
WMSetVolume($oPlayer1, $i)
Sleep(10)
Next
For $i = 0 To 100
WMSetVolume($oPlayer1, $i)
Sleep(10)
Next
; turns the volume down and back up slowly... song2
For $i = 100 To 0 Step -1
WMSetVolume($oPlayer2, $i)
Sleep(10)
Next
For $i = 0 To 100
WMSetVolume($oPlayer2, $i)
Sleep(10)
Next
MsgBox(0, "pause", "")
[/autoit] [autoit][/autoit] [autoit]WMPause($oPlayer1)
[/autoit] [autoit][/autoit] [autoit]Sleep(300)
[/autoit] [autoit][/autoit] [autoit]MsgBox(0, "play", "")
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$rc = WMGetPosition($oPlayer1)
MsgBox(0, "POS", $rc)
WMPlay($oPlayer1)
[/autoit] [autoit][/autoit] [autoit]Sleep(3000)
[/autoit] [autoit][/autoit] [autoit]MsgBox(0, "stop", "")
WMStop($oPlayer1)
WMStop($oPlayer2)
Exit ; ----------------------------
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]; some functions
Func WMLoadFile($wm_obj, $sFilename)
$wm_obj.url = $sFilename
While Not WMGetState($wm_obj) = "Playing"
Sleep(100)
WEnd
EndFunc ;==>WMLoadFile
Func WMSetVolume($wm_obj, $iVol)
;iVol can be between 0 and 100
$wm_obj.settings.volume = $iVol
EndFunc ;==>WMSetVolume
Func WMFastForward($wm_obj)
$wm_obj.controls.fastForward()
EndFunc ;==>WMFastForward
Func WMReverse($wm_obj)
$wm_obj.controls.fastReverse()
EndFunc ;==>WMReverse
Func WMPause($wm_obj)
$wm_obj.controls.pause()
EndFunc ;==>WMPause
Func WMPlay($wm_obj)
$wm_obj.controls.play()
EndFunc ;==>WMPlay
Func WMStop($wm_obj)
$wm_obj.controls.stop()
EndFunc ;==>WMStop
Func WMGetPosition($wm_obj)
Local $pos
$pos = $wm_obj.controls.currentPosition()
Return $pos
EndFunc ;==>WMGetPosition
Func WMGetDuration($wm_obj)
Local $len
$len = $wm_obj.currentMedia.duration
Return $len
EndFunc ;==>WMGetDuration
[/autoit] [autoit][/autoit] [autoit]Func WMGetState($wm_obj)
Local $sStates = "Undefined,Stopped,Paused,Playing,ScanForward,ScanReverse,Buffering,"
$sStates &= "Waiting,MediaEnded,Transitioning,Ready,Reconnecting"
Local $aStates = StringSplit($sStates, ",")
$iState = $wm_obj.playState()
Return $aStates[$iState]
EndFunc ;==>WMGetState