Jump to content
Sign in to follow this  
possy_99

embedded flash player

Recommended Posts

possy_99

hi guys, I visited the forum no so long ago and I could have swore I found a thread regarding embedding flash movies and being able to play it regardless of wether flash player is installed on the target pc, can someone shed any light on this?

I've tried a couple of searches and found threads showing how to embed movies, but they use the ObjCreate("ShockwaveFlash.ShockwaveFlash.1") code, which I don't think would work on a pc without flash player..

any1 help? cheers :)

Share this post


Link to post
Share on other sites
nobbe

hi

you cant embed (use) an object if it doesnt exist on the target system - if you want to play flash without flash object installed you need a player like vlc or smplayer but these cant be "embedded" as objects

Share this post


Link to post
Share on other sites
Squirrely1

I think there is a way using HTML to automatically download the needed ActiveX component, but it might only work if the user has Internet Explorer set to the default setting of "Enable Install on demand (other)".

Look for the html needed to play flv file, on the web or on the AutoIt forums. Then you can use the IE.au3 functions or something to embed the player in an embedded browser window.

Edit6: You are correct - I found this code on my computer but couldn't get it to work for me - it keeps crashing on line 65 no matter what I do - automatically downloads a flash player for .swf files - can you fix it for me?

#include <GUIConstants.au3>
#include <ie.au3>
#include <array.au3>

$flashfile = "C:\My Documents\merryxmas.swf"; probably wants a full url

$gui = GUICreate("Flashy" & $flashfile, 320, 265, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS), $WS_EX_ACCEPTFILES)

$TagsPageC = GUICtrlCreateLabel('Visit Tags Page', 5, 245, 100, 15, $SS_CENTER)
GUICtrlSetFont($TagsPageC, 9, 400, 4)
GUICtrlSetColor($TagsPageC, 0x0000ff)
GUICtrlSetCursor($TagsPageC, 0)
$1C = GUICtrlCreateButton('Showall', 105, 240, 70, 20)
$2C = GUICtrlCreateButton('NoBorder', 175, 240, 70, 20)
$3C = GUICtrlCreateButton('NoScale', 245, 240, 70, 20)

$oIE = _IECreateEmbedded()
$browser = GUICtrlCreateObj($oIE, 10, 10, 300, 225)
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)

_IENavigate($oIE, 'about:blank')
$oDoc = _IEDocGetObj($oIE)
$oDoc.body.style.overflow = "auto"
$oDoc.body.style.margin = "0px"
$oDoc.body.style.padding = "0px"
GUISetState(@SW_SHOW)

$sHTML = '<embed id=flashy src="" '
$sHTML &= 'quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
$sHTML &= 'type="application/x-shockwave-flash" '
$sHTML &= 'width="100%" height="100%"></embed>'
_IEBodyWriteHTML($oIE, $sHTML)

loadswf($flashfile)
$oRP = _IEGetObjByName($oIE, "flashy")

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $TagsPageC
            Run(@ComSpec & ' /c start http://www.myplugins.info/guids/typeinfo/t...-444553540000}', '', @SW_HIDE)
        Case $Msg = $1C
            $oRP.ScaleMode = 0
        Case $Msg = $2C
            $oRP.ScaleMode = 1
        Case $Msg = $3C
            $oRP.ScaleMode = 3
    EndSelect
WEnd


Func loadswf($filename)
    if StringLen($filename) = 0 then
        MsgBox(16, "Flashy", "No flash file specified. Associate SWFs with Flashy, or drop one onto the blank window")
        Return
    EndIf
    if StringRight($filename, 4) <> ".swf"  then
        MsgBox(16, "Flashy - Error", "Dude, that's not a SWF.")
        Return
    EndIf
    $flash = _IEGetObjByName($oIE, "flashy")
    _IENavigate($oIE, $filename)
;$flash.open($filename)
    WinSetTitle($gui, "", "Flashy - " & $filename)
EndFunc;==>loadswf

Edit7: Code works now, but throws a warning. Buttons on the GUI throw an error if pushed on my XP service pack 1 using IE 6.0.2800.1106...

I didn't uninstall my Adobe flash player to see if this code with automatically download it - tell us if this works to do that - you need to use your own .swf file on line 5 of the code.

Edited by Squirrely1

Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites
Squirrely1

My last post was updated with the sought-for code!


Das Häschen benutzt Radar

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.