Jump to content

Recommended Posts

Posted (edited)

This could look the same as if you were to embed a video in a website.

It embeds WMP into a gui, This is beta.

the example should help a lot

Let me know what you think

Thanks

UPDATED ON 09/06/07 WITH MORE FUNCTIONS

#include <GUIConstants.au3>
#include <wmp.au3>

Opt("GUIOnEventMode", 1)

$Form1 = GUICreate("AForm1", 518, 439, 192, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "quit")
$wmp = _wmpcreate(1, 8, 8, 425, 425);creates object
_wmpvalue( $wmp, "nocontrols" );hides controls
_wmploadmedia( $wmp, @HomeDrive & "\WINDOWS\clock.avi" );loads media
;_wmpsetvalue( $wmp, "controls" );shows controls
$slider = GUICtrlCreateSlider( 4, 330, 330, 25 )
GUICtrlSetOnEvent( -1, "change" )
GUISetState(@SW_SHOW)

While _wmpvalue($wmp,"getduration") = 0
    Sleep(1)
WEnd
GUICtrlSetLimit($slider,_wmpvalue($wmp,"getduration"),0)
GUISetState(@SW_SHOW)

While 1
Sleep(100)
GUICtrlSetData( $slider, _wmpvalue($wmp,"getposition"))
WEnd

Func quit()
    Exit
EndFunc

Func change()
    _wmpvalue($wmp,"setposition",GUICtrlRead($slider))
EndFunc

#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 CyberZeroCool
Check out ConsultingJoe.com
  • 2 months later...
Posted

I want to see this also, could you post the script again please?

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Posted (edited)

I want to see this also, could you post the script again please?

it mysteriously disapeared? :whistle:

I think this is it..

WMP.au3

#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
    If $autostart = 1 And $object.controls.isAvailable("play") 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 _wmpsetvalue( $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
    EndSelect
EndFunc

WMP_Example.au3

#include <GUIConstants.au3>
#include <wmp.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 518, 439, 192, 125)
$wmp = _wmpcreate(1, 8, 8, 425, 425);creates object
_wmpsetvalue( $wmp, "nocontrols" );hides controls
GUISetState(@SW_SHOW)
_wmploadmedia( $wmp, @HomeDrive & "\WINDOWS\clock.avi" );loads media
;Sleep(1000)
;_wmpsetvalue( $wmp, "controls" );shows controls
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
;;;;;;;
    EndSelect
WEnd
Exit
Edited by WTS
Posted

Thanks

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
  • 11 months later...
Posted (edited)

When I try play an AVI video with this, it plays the audio but doesn't show the video, just a black square. Here is my code:

$display = _wmpcreate(1, 181, 10, 280, 210)
_wmploadmedia($display, $readfrom, 0)
_wmpsetvalue($display, "control")

By the way, the functions are really good! Thanks!

Edited by BananaFredSoft
Posted

When I try play an AVI video with this, it plays the audio but doesn't show the video, just a black square. Here is my code:

$display = _wmpcreate(1, 181, 10, 280, 210)
_wmploadmedia($display, $readfrom, 0)
_wmpsetvalue($display, "control")

By the way, the functions are really good! Thanks!

Be sure $readfrom is a valid path and __wmpsetvalue($display, "control") is false, it's _wmpsetvalue($display, "controls").

  • 1 month later...
Posted

This looks very good. I did notice that you can not use the slider though to select where you want to listen from or go back to. Is there anyway to get that to work otherwise this is sweet.

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
  • Recently Browsing   0 members

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