Belini

UDF indication to run videos .mp4

8 posts in this topic

#1 ·  Posted (edited)

I've googled a lot and I have not found a UDF to play .mp4 videos in a small frame in the GUI, can anyone give a hint?

Edited by Belini

Share this post


Link to post
Share on other sites



@dmob you tell if I can use this UDF with the portable version of VLC?

@PACaleala I could not test because the code that is there is full of strange characters and missing part in some functions too, you have code that is working?

Share this post


Link to post
Share on other sites

I found a code made by @jscript using the in-built Media Player but I was unable to close the video that is playing to put another and here are getting several videos open at the same time, does anyone know how to close the video to perform next?

 

#include <guiconstantsex.au3>
    #include <windowsconstants.au3>
    #include <ButtonConstants.au3>
    #include <WinAPI.au3>
    #include <IE.au3>
     
    _Example(@ScriptDir & "\teste.mp4") ; File name of media!
     
    ; example
    Func _Example($sFileName)
        Local $hForm, $aiCliSize, $iCtrlID
     
        ;$hForm = GUICreate("MediaPlayer_Embedded!", 640, 480, -1, -1, BitOR($WS_POPUP, $WS_SIZEBOX), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
        ;$aiCliSize = WinGetClientSize($hForm)
        ;$iCtrlID = _MediaPlayerEmbeded($sFileName, -2, -2, 640, 490)
        ;GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
        ; Or
        $hForm = GUICreate("MediaPlayer_Embedded!", 640, 480, -1, -1, $WS_POPUP)
        $aiCliSize = WinGetClientSize($hForm)
     
        $iCtrlID = _MediaPlayerEmbeded($sFileName, 1, 1, $aiCliSize[0], $aiCliSize[1])
     
     
        GUISetState()
     
        ;Sleep(2000)
        ;GUICtrlSetState($iCtrlID, $GUI_HIDE)
        ;Sleep(2000)
        ;GUICtrlSetState($iCtrlID, $GUI_SHOW)
     
        ; Run the GUI until the dialog is closed
        While 1
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                    Exit
            EndSwitch
        WEnd
    EndFunc   ;==>_Example
     
    ; #FUNCTION# ====================================================================================================================
    ; Name ..........: _MediaPlayerEmbeded
    ; Description ...:
    ; Syntax ........: _MediaPlayerEmbeded( $sFileName, $iLeft, $iTop, $iWidth, $iHeight )
    ; Parameters ....: $sFileName           - A string value.
    ;                  $iLeft               - An integer value.
    ;                  $iTop                - An integer value.
    ;                  $iWidth              - An integer value.
    ;                  $iHeight             - An integer value.
    ; Return values .: None
    ; Author ........: JScript
    ; Modified ......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........:
    ; Example .......: _MediaPlayerEmbeded($sFileName, $iLeft, $iTop, $iWidth, $iHeight)
    ; ===============================================================================================================================
    Func _MediaPlayerEmbeded($sFileName, $iLeft, $iTop, $iWidth, $iHeight)
        Local $oShell, $sInnerHTML, $iCtrlID
     
        $sInnerHTML = '<object id="player" height="100%" width="100%" align="middle" ' & _
                'classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"> ' & _
                ' <param name="URL" value="' & $sFileName & '">' & _
                ' <param name="uiMode" value="none"> ' & _
                ' <param name="fullScreen" value="false"> ' & _
                ' <param name="ShowControls" value="true"> ' & _
                ' <param name="ShowStatusBar" value="true"> ' & _
                ' <param name="ShowDisplay" value="true"> ' & _
                ' <embed type="application/x-mplayer2" ' & _
                ' pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/" ' & _
                ' SRC="' & $sFileName & '"' & _
                '</embed></object>'
     
        $oShell = ObjCreate("Shell.Explorer")
        $iCtrlID = GUICtrlCreateObj($oShell, $iLeft, $iTop, $iWidth, $iHeight)
     
        $oShell.navigate("about:blank")
        While $oShell.Busy()
            Sleep(10)
        WEnd
        With $oShell.document
            .write('<HEAD><TITLE></TITLE><script language="javascript"></script></HEAD>')
            .write('<body onselectstart="return false" oncontextmenu="return false" onclick="return false" ondragstart="return false" ondragover="return false">')
            .body.innerHTML = $sInnerHTML
            .body.topmargin = 0
            .body.leftmargin = 0
            .body.scroll = "no"
            .body.bgcolor = 0x000000
            .body.style.borderWidth = 0
        EndWith
     
        Return $iCtrlID
    EndFunc   ;==>_MediaPlayerEmbeded
     
    Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam)
        #forceref $hWnd, $iMsg, $wParam, $lParam
     
        Local $iDef = _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam)
     
        Switch $iDef
            Case $HTSYSMENU, $HTBOTTOM, $HTBOTTOMLEFT, $HTBOTTOMRIGHT, $HTLEFT, $HTRIGHT, $HTTOP, $HTTOPLEFT, $HTTOPRIGHT
                Return $HTCAPTION; -1 to not moving!
        EndSwitch
     
        Return $iDef
    EndFunc   ;==>WM_NCHITTEST

 

Share this post


Link to post
Share on other sites

No one knows how I can close the previous video to another place to play using the embedded media player?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hello. I think is redundant embebed the windows media Player control using html. you can use autoit object functions instead.

 

here is the doc of windows media player. 

https://msdn.microsoft.com/en-us/library/windows/desktop/dd564680(v=vs.85).aspx

Saludos

Edited by Danyfirex

Share this post


Link to post
Share on other sites

Thanks for the tip @Danyfirex I'll see if I can get something from the information that is there

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