Sign in to follow this  
Followers 0
AlmarM

Question about Flash + .flv files

13 posts in this topic

Hi,

Where I live, we have an awesome comedy show called "De Lama's". I want to make a player for the movies from a site.

I can't seem to load the "file" (movie) into the flash player. There is some Java Script, Flash and .flv

I'm not even sure if this is possible, but I gave it a try. Full site: Here.

Here's the Javascript in the Site's sourcode:

<script type="text/javascript">
                  var so = new SWFObject('/static/101v3/player-custom/player.swf','plyr','584','358','9');
                  so.addParam('allowscriptaccess','always');
                  so.addParam('allowfullscreen','true');
        
            so.addVariable('plugins','/static/global/swf/jwp4-streamsense-plugin.swf');
            so.addVariable('log','http://nl.sitestat.com/klo/bnn/s?bnn.101tv.video');
            so.addVariable('ss_station','BNN');
            so.addVariable('ss_program_title','101tv');
            so.addVariable('ss_date_production','');
            so.addVariable('ss_episode_title','');
            so.addVariable('ss_type_stream','flv');
        
                  so.addVariable('config', '/static/101v3/player/config.xml');
                                  so.addVariable('image', 'http://download.omroep.nl/bnn/mediadepot/video_images/4/8/8812_1.jpg');
                  so.addVariable('file', 'http://download.omroep.nl/bnn/mediadepot/flv/4/10/8812.flv');
                                                  so.addVariable('logo', '/static/101v3/player-logos/101.png');
                                  so.write('videoplayer');
                </script>

And here's my script:

Global $sPlayer = "http://www.101.tv/static/101v3/player-custom/player.swf"
Global $sMovie = "http://download.omroep.nl/bnn/mediadepot/flv/4/10/8812.flv"

$GUI = GUICreate("Lama's", 605, 345)

$oObj = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$oPlayer = GUICtrlCreateObj($oObj, 10, 10, 585, 325)

With $oObj
    .Movie = $sPlayer
    .Bgcolor = "#000000"
    .SetVariable('plugins','http://www.101.tv/static/global/swf/jwp4-streamsense-plugin.swf')
    .SetVariable('ss_station','BNN')
    .SetVariable('ss_program_title','101tv')
    .SetVariable('ss_date_production','')
    .SetVariable('ss_episode_title','')
    .SetVariable('ss_type_stream','flv')
    .SetVariable('config', '')
    .SetVariable('image', 'http://download.omroep.nl/bnn/mediadepot/video_images/4/8/8812_1.jpg')
    .SetVariable('file', 'http://download.omroep.nl/bnn/mediadepot/flv/4/10/8812.flv')
    .SetVariable('logo', 'http://www.101.tv/static/101v3/player-logos/101.png')
EndWith
    
GUISetState()
While 1
    Switch GUIGetMsg()
    Case -3
        Exit
    EndSwitch
Wend

Hope someone knows what I mean and mayby will be able to help me. :)


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You seem to set up the object ok but you have to do something with it. For a site I use, I have embedded the movie as an object into the html (I have another script that sets it up). Its the EMBED tag that gets it to play (I think - I know RunContent is required too). Not sure how to do this in AutoIt, hope that helps.

I use something like this in the HTML

<  <script type="text/javascript">
                            AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','690','height','350','src','idslideshow','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','idslideshow' ); //end AC code
                        </SCRIPT>
          <NOSCRIPT>
          <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="690" height="350">
            <PARAM name="movie" value="idslideshow.swf">
            <PARAM name="quality" value="high">
            <EMBED src="idslideshow.swf" QUALITY="high" PLUGINSPAGE="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" TYPE="application/x-shockwave-flash" width="649" height="323"></EMBED>
          </OBJECT>
          </NOSCRIPT>
        </DIV>
Edited by bo8ster

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

So I should create a new HTMl document with the same code, and then EMBED it?


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

If you can embed the video in HTML, I don't see why you shouldn't be able to wrap a GUI around it. I tried to open the stream in VLC, but encountered some problems. Perhaps that's something to do with my computer, but seeing as you are also having problems, perhaps there is an issue with the stream?

Share this post


Link to post
Share on other sites

I just started learning HTML, PHP, etc. So I nhave to idea if is corret.

My try:

<html>
    <head>
        <title></title>
    </head>
    <body>
        <script type="text/javascript">
            var so = new SWFObject('http://www.101.tv/static/101v3/player-custom/player.swf','plyr','584','358','9');
            so.addParam('allowscriptaccess','always');
            so.addParam('allowfullscreen','true');
            so.addVariable('plugins','http://www.101.tv/static/global/swf/jwp4-streamsense-plugin.swf');
            so.addVariable('log','http://nl.sitestat.com/klo/bnn/s?bnn.101tv.video');
            so.addVariable('ss_station','BNN');
            so.addVariable('ss_program_title','101tv');
            so.addVariable('ss_date_production','');
            so.addVariable('ss_episode_title','');
            so.addVariable('ss_type_stream','flv');
            so.addVariable('config', 'http://www.101.tv/static/101v3/player/config.xml');
            so.addVariable('image', 'http://download.omroep.nl/bnn/mediadepot/video_images/4/8/8812_1.jpg');
            so.addVariable('file', 'http://download.omroep.nl/bnn/mediadepot/flv/4/10/8812.flv');
            so.addVariable('logo', 'http://www.101.tv/static/101v3/player-logos/101.png');
            so.write('videoplayer');
        </script>
    </body>
</html>

:)


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I don't know what happened previously when I tried VLC media player, because it played the video on a second attempt. I tried some alternatives to embed the video without success. Perhaps I could find a solution given long enough, but it's not necessary. The website provides code to embed the videos when you click on the video links. :)

Here's a sample:

<html>
 <head>
  <title>Test</title>
 </head>
<body>
 <embed width="420" height="290" 
 flashvars="hash=422cbd97ddb6c4bc86fb24b672d18c21&swf_width=420&swf_height=290&website=101v2/" 
 allowfullscreen="true"  
 quality="high" 
 src="http://www.bnn.nl/players/play/play.php?type=101" 
 type="application/x-shockwave-flash"/>
</body>
</html>

You could change the width/height. You could also create a playlist with AutoIt, either by altering the html code, or creating separate html files for each episode. I hope this helps.

EDIT: Of course, if you want to watch the videos off line, you will have to download the .flv files and use another method to view them. Try VLC if you haven't already done so.

Edited by czardas

Share this post


Link to post
Share on other sites

So I should create a new HTMl document with the same code, and then EMBED it?

I would say yes, I see your example but there needs to be somewhere where the 'so' (SWFObject) object is used. I believe object tags are required as 'so' is a object. I'm not a complete expert, the code given was created with Dreamweaver but I remember you set up the object then place it somewhere. You have to tell the browser where to place the object and how to use it once created. You should be able to see many examples on the net if you don't have a HTML generator.

Once you have the HTML working you should be able to use _IECreateEmbedded() to run the HTML within your GUI.

Here are some good links I found.

http://www.flvplay.com/FLVPlay/support/customizer.html

http://www.boutell.com/newfaq/creating/video.html (scroll to the end)

http://www.ffmpegx.com/flv.html (scroll down)


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

it helps to know javascript and flash(actionscript, both are based on emcascript) in this case -

<script type="text/javascript">
            var so = new SWFObject('/static/101v3/player-custom/player.swf','plyr','584','358','9'); // this is creating a new object
            so.addParam('allowscriptaccess','always'); // this is setting a parameter (variable in autoit)
            so.addParam('allowfullscreen','true');

            so.addVariable('plugins','/static/global/swf/jwp4-streamsense-plugin.swf'); // this is adding to the flashvars parameter
            so.addVariable('log','http://nl.sitestat.com/klo/bnn/s?bnn.101tv.video');
            so.addVariable('ss_station','BNN');
            so.addVariable('ss_program_title','101tv');
            so.addVariable('ss_date_production','');
            so.addVariable('ss_episode_title','');
            so.addVariable('ss_type_stream','flv');

            so.addVariable('config', '/static/101v3/player/config.xml');
            so.addVariable('image', 'http://download.omroep.nl/bnn/mediadepot/video_images/4/8/8812_1.jpg');
            so.addVariable('file', 'http://download.omroep.nl/bnn/mediadepot/flv/4/10/8812.flv');
            so.addVariable('logo', '/static/101v3/player-logos/101.png');

            so.write('videoplayer'); // this is writing the embed or object tag to the document
        </script>

to properly emulate this, you need the following

Global $sPlayer = "http://www.101.tv/static/101v3/player-custom/player.swf"
Global $sMovie = "http://download.omroep.nl/bnn/mediadepot/flv/4/10/8812.flv"

$GUI = GUICreate("Lama's", 605, 345)

$oObj = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$oPlayer = GUICtrlCreateObj($oObj, 10, 10, 585, 325)

With $oObj
    .Movie = $sPlayer
    .Bgcolor = "#000000"
    .SetVariable('allowfullscreen', 'true')
    .SetVariable('allowscriptaccess', 'never') ;~ if allowed, it could possibly open security holes. and i
;~ haven't visited the page so you may need to make your own program in C++/C# to use this properly, if they
;~ use FSCommand. if they use ExternalInterface then you NEED to use a browser, a lite version you built
;~ yourself would be best for this latter case. documentation for flash/actionscript can be found on adobe.com

    .SetVariable('flashvars','plugins=http://www.101.tv/static/global/swf/jwp4-streamsense-plugin.swf&log=http://nl.sitestat.com/klo/bnn/s?bnn.101tv.video&ss_station=BNN&ss_program_title=101tv&ss_type_stream=flv&config=http://www.101.tv/static/101v3/player/config.xml&image=http://download.omroep.nl/bnn/mediadepot/video_images/4/8/8812_1.jpg&file=http://download.omroep.nl/bnn/mediadepot/flv/4/10/8812.flv&logo=http://www.101.tv/static/101v3/player-logos/101.png&_url=http://www.101.tv/page/1012009/video/cdaefb880c5827d2d5fc293ef1c40350')
EndWith
    
GUISetState()
While 1
    Switch GUIGetMsg()
    Case -3
        Exit
    EndSwitch
Wend

as a note - i haven't tested the code above

edit: and in the flashvars, it's a url-encoded string (sorta, i don't feel like manually escaping : and /) the last parameter, _url; i added just incase they have some sort of site-lock on it, that will break it if they use _url from _root in AS2; do not know for AS3

Edited by skyboy

Share this post


Link to post
Share on other sites

I think this is getting overcomplicated. Half of the javascript seems unnecessary. I'm not so sure, but perhaps it would be better placed in the head of the document. If AlmarM is just starting to learn HTML, then I think it would make more sense to leave javascript out of the equation for a while. The links provided by the website work fine for me.

I would personally grab all the video links provided by the website and put them into an array. I would then create one html document and write to it using AutoIt. You could then change the video simply by refreshing the page. Put a front end on it using AutoIt _IECreateEmbedded() - as mentioned previously by bo8ster - and your done.

Share this post


Link to post
Share on other sites

in the javascript source, only two lines are unnecessary (it's used instead of a direct-embed due to microsoft screwing with things... again) and the SWFObject constructor function is not a default function, so any script without the external file (it can be linked from other sites, though it's a bad idea because you have zero control over it; and it can be embedded in the document, though it's often inadvisable to keep the actual content page small and faster to load) will fail to create the swf embed, only throw a number of errors at you in the error console of the browser. and if at all possible, use the dll for non-microsoft browsers, those tend to have more functionality and run flash faster (screwy things with microsoft's implementation that can prevent flash from running properly even with the proper version)

Share this post


Link to post
Share on other sites

http://rapidshare.com/files/315983204/FLVPlayer.rar (714 KB)

included are: autoit source, FLV player source, FLV player SWF: compressed, autoit container exe: compressed; the FLV player took me a couple hours to make, autoit i had to look some things up for using C# to get COM object names after a few hours of searching google

Global $sPlayer = "/FLVPlay.swf"
Global $sMovie = "http://download.omroep.nl/bnn/mediadepot/flv/4/10/8812.flv?fromExe"

$GUI = GUICreate("Lama's", 800, 506)

$oObj = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$oPlayer = GUICtrlCreateObj($oObj, 0, 0, 800, 506)

With $oObj
    .Bgcolor = "#000000"
    .AllowFullscreen = true
    .AllowNetworking = "all"
    .AllowScriptAccess = "never"
    .FlashVars = "flv="&$sMovie
    .Movie = @ScriptDir&$sPlayer
;~  .DisableLocalSecurity()
EndWith
    
GUISetState()
While 1
    Switch GUIGetMsg()
    Case -3
        Exit
    EndSwitch
Wend

the commented line should only be used on well trusted (yourself) sources

something that would be useful for fullscreen apps (could be added to this to get fullscreen flash movies/games while still allowing you to control the thing [adobe disables all input methods when you use the inbuilt fullscreen]) :

Global $vDLL = DllOpen("user32.dll")

    DllCall($vDll, "int", "SetWindowLong", "hwnd", $hWnd, "int", 0xFFFFFFF0, "int", BitAND(0x90000200, 0xFF00FF7F))
    DllCall($vDll, "int", "SetWindowLong", "hwnd", $hWnd, "int", 0xFFFFFFEC, "int", 0x00040040)
    WinMove($winTitle, "", 0, 0, @DesktopWidth, @DesktopHeight)

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  
Followers 0