Jump to content
Sign in to follow this  
Fabian

embeded-mediaUDF

Recommended Posts

I'am working on a udf collection for embeding media in an autoitscript. Currently Quicktime, WMP and Flash are supported. If you have any idea for new functions, post them. Thanks to CyberZeroCool for his great Windows Media Player Embed UDF's.

-Added Check if Flash is installed

Example & Download:

Here

UDF's:

;----------------------------------
;-------QuickTime Functions--------
;----------------------------------

#cs
_qtcreate($show, $left, $top, $width = 100, $height = 100)
$show:     1 = creates the control
           2 = doesn't create the control

Return: The object for the control
#ce
Func _qtcreate($show, $left, $top, $width = 100, $height = 100)
    $oQT = ObjCreate("QTOControl.QTControl")
    If $oQT = 0 Then Return 0
    If $show = 1 Then
        GUICtrlCreateObj($oQT, $left, $top, $width, $height)
    EndIf
    Return $oQT
EndFunc
#cs
_qtloadmedia( $object, $URL, $autostart = 1 )
$object:       Object returned from the _qtcreate()
$URL:          Path or URL of the media
$autostart:    1 = yes
               0 = no

Return: None
#ce
Func _qtloadmedia( $object, $URL, $autostart = 1 )
    $object.URL = $URL
    _qtautostart($object, $autostart)
EndFunc
#cs
_qtautostart($object, $autostart)
$object:    Object returned from the _qtcreate()
$param:     0 = disable autoplay
            1 = enable autoplay

Return: The object for the control
#ce
Func _qtautostart($object, $autostart)
    If $autostart = 0 Then
        $object.Autoplay = False
    ElseIf $autostart = 1 Then
        $object.Autoplay = True
    EndIf
EndFunc
#cs
_qtgetv($object)
$object:    Object returned from the _qtcreate()

Return: version of quicktime
#ce
Func _qtgetv($object)
        $Version = $object.QuickTimeVersion()
    Return $Version
EndFunc



;----------------------------------
;------Adobe Flash Functions-------
;----------------------------------

#cs
_flashcreate($show, $left, $top, $width = 100, $height = 100)
$show:      1 = creates the control
            2 = doesn't create the control

Return: The object for the control
#ce
Func _flashcreate($show, $left, $top, $width = 100, $height = 100)
    If FileFindFirstFile(@SystemDir & "\Macromed\Flash\flash*.ocx") = -1 Then
        $Value = MsgBox(20, "Error", "It seems that you don't have Flash Player installed. Please download" & @CRLF & "it from www.adobe.com. Do you want to go there now?")
        If $Value = 6 Then
            ShellExecute("www.adobe.com")
        EndIf
        Exit
    EndIf      
    $oFlash = ObjCreate("ShockwaveFlash.ShockwaveFlash")
    If $oFlash = 0 Then Return 0
    If $show = 1 Then
        GUICtrlCreateObj($oFlash, $left, $top, $width, $height)
    EndIf
    Return $oFlash
EndFunc
#cs
_flashloadmedia($object, $URL)
$object:       Object returned from the _flashcreate()
$URL:          Path or URL of the media
Return: None
#ce
Func _flashloadmedia($object, $URL)
    $object.LoadMovie(0, $URL)
EndFunc
#cs
_flashsetvalue($object, $setting)
$object:    Object returned from the _flashcreate()
$setting:   "play"
            "stop"

Return: None
#ce
Func _flashvalue($object, $setting)
        Select
    Case $setting = "play"
            $object.play()
        Case $setting = "stop"
            $object.stop()
    EndSelect
EndFunc


;----------------------------------
;--Windows Media Player Functions--
;----------------------------------

#cs
_wmpcreate($show, $left, $top, $width = 100, $height = 100)
$show:     1 = shows controls
           2 = hides controls

Return: The object for the control
#ce
Func _wmpcreate($show, $left, $top, $width = 100, $height = 100)
$oWMP = ObjCreate("WMPlayer.OCX")
If $oWMP = 0 Then Return 0
$oWMP.settings.autoStart = "False"
If $show = 1 Then
    GUICtrlCreateObj($oWMP, $left, $top, $width, $height)
EndIf
Return $oWMP
EndFunc
#cs
_wmploadmedia( $object, $URL, $autostart = 1 )
$object:    Object returned from the _wmpcreate()
$URL:        Path or URL of the media
$autostart:    1 = yes
               0 = no

Return: None
#ce
Func _wmploadmedia( $object, $URL, $autostart = 1 )
    $object.URL = $URL
    While Not $object.controls.isAvailable("play")
        Sleep(1)
    WEnd
    If $autostart = 1 Then $object.controls.play()
EndFunc
#cs
_wmpsetvalue( $object, $setting, $para=1 )
$object:    Object returned from the _wmpcreate()
$setting:   "play"
            "stop"
            "pause"
            "invisible" (Hides all)
            "control"    (Shows controls)
            "nocontrol"    (Hides controls)
            "fullscreen"
            "step"        (frames to step before freezing)
            "fastforward"
            "fastreverse"
            "volume"    (0 To 100)
            "rate"        (-10 To 10)
            "playcount"

Return: None
#ce
Func _wmpvalue( $object, $setting, $para=1 )
        Select
            Case $setting = "play"
            If $object.controls.isAvailable("play") Then $object.controls.play()
        Case $setting = "stop"
            If $object.controls.isAvailable("stop") Then $object.controls.stop()
        Case $setting = "pause"
            If $object.controls.isAvailable("pause") Then $object.controls.pause()
        Case $setting = "invisible"
            $object.uiMode = "invisible"
        Case $setting = "controls"
            $object.uiMode = "mini"
        Case $setting = "nocontrols"
            $object.uiMode = "none"
        Case $setting = "fullscreen"
            $object.fullscreen = "true"
        Case $setting = "step"
            If $object.controls.isAvailable("step") Then $object.controls.step($para)
        Case $setting = "fastForward"
            If $object.controls.isAvailable("fastForward") Then $object.controls.fastForward()
        Case $setting = "fastReverse"
            If $object.controls.isAvailable("fastReverse") Then $object.controls.fastReverse()
        Case $setting = "volume"
            $object.settings.volume = $para
        Case $setting = "rate"
            $object.settings.rate = $para
        Case $setting = "playcount"
            $object.settings.playCount = $para
        Case $setting = "setposition"
            $object.controls.currentPosition = $para
        Case $setting = "getposition"
            Return $object.controls.currentPosition
        Case $setting = "getpositionstring";Returns HH:MM:SS
            Return $object.controls.currentPositionString
        Case $setting = "getduration"
            Return $object.currentMedia.duration
    EndSelect
EndFunc
Edited by Fabian

embeded-mediaUDF ~~ Embed WMP, Quicktime and Flash in your Au3 appYABC ~~ Yet another Binary Clock

Share this post


Link to post
Share on other sites

Thanks. Just one note. Some times the WMP embeded object messes up in size and controls. You would just have to play with it to see what I mean.


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

You may want to have a feature that detects if Flash is installed or not. If it isn't, then give them the option of installing it.

found a link that may help:

http://www.autoitscript.com/forum/index.php?showtopic=57279

Share this post


Link to post
Share on other sites

ok, i'll try

Here is the new version:

;----------------------------------
;-------QuickTime Functions--------
;----------------------------------

#cs
_qtcreate($show, $left, $top, $width = 100, $height = 100)
$show:     1 = creates the control
           2 = doesn't create the control

Return: The object for the control
#ce
Func _qtcreate($show, $left, $top, $width = 100, $height = 100)
    $oQT = ObjCreate("QTOControl.QTControl")
    If $oQT = 0 Then Return 0
    If $show = 1 Then
        GUICtrlCreateObj($oQT, $left, $top, $width, $height)
    EndIf
    Return $oQT
EndFunc
#cs
_qtloadmedia( $object, $URL, $autostart = 1 )
$object:       Object returned from the _qtcreate()
$URL:          Path or URL of the media
$autostart:    1 = yes
               0 = no

Return: None
#ce
Func _qtloadmedia( $object, $URL, $autostart = 1 )
    $object.URL = $URL
    _qtautostart($object, $autostart)
EndFunc
#cs
_qtautostart($object, $autostart)
$object:    Object returned from the _qtcreate()
$param:     0 = disable autoplay
            1 = enable autoplay

Return: The object for the control
#ce
Func _qtautostart($object, $autostart)
    If $autostart = 0 Then
        $object.Autoplay = False
    ElseIf $autostart = 1 Then
        $object.Autoplay = True
    EndIf
EndFunc
#cs
_qtgetv($object)
$object:    Object returned from the _qtcreate()

Return: version of quicktime
#ce
Func _qtgetv($object)
        $Version = $object.QuickTimeVersion()
    Return $Version
EndFunc



;----------------------------------
;------Adobe Flash Functions-------
;----------------------------------

#cs
_flashcreate($show, $left, $top, $width = 100, $height = 100)
$show:      1 = creates the control
            2 = doesn't create the control

Return: The object for the control
#ce
Func _flashcreate($show, $left, $top, $width = 100, $height = 100)
    If FileFindFirstFile(@SystemDir & "\Macromed\Flash\flash*.ocx") = -1 Then
        $Value = MsgBox(20, "Error", "It seems that you don't have Flash Player installed. Please download" & @CRLF & "it from www.adobe.com. Do you want to go there now?")
        If $Value = 6 Then
            ShellExecute("www.adobe.com")
        EndIf
        Exit
    EndIf        
    $oFlash = ObjCreate("ShockwaveFlash.ShockwaveFlash")
    If $oFlash = 0 Then Return 0
    If $show = 1 Then
        GUICtrlCreateObj($oFlash, $left, $top, $width, $height)
    EndIf
    Return $oFlash
EndFunc
#cs
_flashloadmedia($object, $URL)
$object:       Object returned from the _flashcreate()
$URL:          Path or URL of the media
Return: None
#ce
Func _flashloadmedia($object, $URL)
    $object.LoadMovie(0, $URL)
EndFunc
#cs
_flashsetvalue($object, $setting)
$object:    Object returned from the _flashcreate()
$setting:   "play"
            "stop"

Return: None
#ce
Func _flashvalue($object, $setting)
        Select
    Case $setting = "play"
            $object.play()
        Case $setting = "stop"
            $object.stop()
    EndSelect
EndFunc


;----------------------------------
;--Windows Media Player Functions--
;----------------------------------

#cs
_wmpcreate($show, $left, $top, $width = 100, $height = 100)
$show:     1 = shows controls
           2 = hides controls

Return: The object for the control
#ce
Func _wmpcreate($show, $left, $top, $width = 100, $height = 100)
$oWMP = ObjCreate("WMPlayer.OCX")
If $oWMP = 0 Then Return 0
$oWMP.settings.autoStart = "False"
If $show = 1 Then
    GUICtrlCreateObj($oWMP, $left, $top, $width, $height)
EndIf
Return $oWMP
EndFunc
#cs
_wmploadmedia( $object, $URL, $autostart = 1 )
$object:    Object returned from the _wmpcreate()
$URL:        Path or URL of the media
$autostart:    1 = yes
               0 = no

Return: None
#ce
Func _wmploadmedia( $object, $URL, $autostart = 1 )
    $object.URL = $URL
    While Not $object.controls.isAvailable("play")
        Sleep(1)
    WEnd
    If $autostart = 1 Then $object.controls.play()
EndFunc
#cs
_wmpsetvalue( $object, $setting, $para=1 )
$object:    Object returned from the _wmpcreate()
$setting:   "play"
            "stop"
            "pause"
            "invisible" (Hides all)
            "control"    (Shows controls)
            "nocontrol"    (Hides controls)
            "fullscreen"
            "step"        (frames to step before freezing)
            "fastforward"
            "fastreverse"
            "volume"    (0 To 100)
            "rate"        (-10 To 10)
            "playcount"

Return: None
#ce
Func _wmpvalue( $object, $setting, $para=1 )
        Select
            Case $setting = "play"
            If $object.controls.isAvailable("play") Then $object.controls.play()
        Case $setting = "stop"
            If $object.controls.isAvailable("stop") Then $object.controls.stop()
        Case $setting = "pause"
            If $object.controls.isAvailable("pause") Then $object.controls.pause()
        Case $setting = "invisible"
            $object.uiMode = "invisible"
        Case $setting = "controls"
            $object.uiMode = "mini"
        Case $setting = "nocontrols"
            $object.uiMode = "none"
        Case $setting = "fullscreen"
            $object.fullscreen = "true"
        Case $setting = "step"
            If $object.controls.isAvailable("step") Then $object.controls.step($para)
        Case $setting = "fastForward"
            If $object.controls.isAvailable("fastForward") Then $object.controls.fastForward()
        Case $setting = "fastReverse"
            If $object.controls.isAvailable("fastReverse") Then $object.controls.fastReverse()
        Case $setting = "volume"
            $object.settings.volume = $para
        Case $setting = "rate"
            $object.settings.rate = $para
        Case $setting = "playcount"
            $object.settings.playCount = $para
        Case $setting = "setposition"
            $object.controls.currentPosition = $para
        Case $setting = "getposition"
            Return $object.controls.currentPosition
        Case $setting = "getpositionstring";Returns HH:MM:SS
            Return $object.controls.currentPositionString
        Case $setting = "getduration"
            Return $object.currentMedia.duration
    EndSelect
EndFunc

Edited by Fabian

embeded-mediaUDF ~~ Embed WMP, Quicktime and Flash in your Au3 appYABC ~~ Yet another Binary Clock

Share this post


Link to post
Share on other sites

Does anyone know if it's possible to get the dimensions of a Quicktime movie, I'm loading .mov's from local content and would like to position them on the screen according to their size.

Secondly, after using _qtcreate to create the embedded movie, I am unable to remove it from the screen. Anyone got any ideas? Even if I set another gui control to be on top, the player window remains. At the minimum I want to hide the player window until it's next needed.

Share this post


Link to post
Share on other sites

Solved my qt control issue, the embedded media udf doesn't provide a handle to the actual gui control, so instead of using the udf I created my own function and now I can just use GuiCtrlDelete when I'm done.

The only problem I'm left with is this one

Share this post


Link to post
Share on other sites

Hi sorry for posting in such an old topic, but it seems to be the answer to my researches.

I find it awsome that Fabian created an UDF allowing to embed Quicktime to an autoit GUI.

But unfortunatly the link to the example file doesn't work anymore.

So I'm posting this in order to ask if anyone had downloaded the example file and could upload it again.

Cheers

Kaba

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...