I was wondering if its possible to pass a url to the file param as I have a special page that streams my flash video content. I have an example below. Everything works fine if I replace the file param with the file path but for security reasons we don't allow access directly to the file.
<div id="fla"></div> <script type="text/javascript"> // <![CDATA[ var so = new SWFObject("/flash/flvplayer.swf", "Player627", "200", "100", "7", "#ffffff"); so.addParam("wmode", "transparent"); so.addVariable("file","http://url/stream.file.aspx?id=1&key=specialkey"); so.addVariable("showdigits","true"); so.addVariable("autostart","false"); so.write("fla"); //]]> </script> <br/> </div>
The example I have above is what I am currently trying to do. I am currently using the exact same logic with embeded Windows Media player and Quicktime and both players play the content fine.
The .aspx file in the URL above does a binary read of a flash .flv file and then writes this binary content to the http output stream.
In the Windows Media Player and Quicktime implementations I have already done, the player thinks the actual file is being streamed to it and starts to buffer and play as it would if you had given a physical file path.
In effect, I have replaced the physical file "/ralph.flv" with a link to a binary stream "http://url/stream.file.aspx?id=1&key=specialkey".
Does that clear it up at all?
I was wondering if the SWFObject does any kind of modification to the file parameter.
What you can pass into flash via flashvars (which is what addVariable() does) is just a string. If you want to actually get the file, then you have to load that URL within flash.
If you are using the media player component, then you would set its contentPath property to your http://url/stream.file.aspx?id=1&key=specialkey location, and the component would go off and load the FLV.
.....just a quick thing, I am assuming I can get access to the ContentPath property through tags as I don't have the code to the media player I am using? I've done a few tests with the embeded media player and trying to use a ContentPath property but none have worked.
just a followup, if found what i was looking for and that is the streamscript variable. so.addVariable("streamscript", "http://localhost/stream.aspx?id=1");
i'm now just trying to fix some problems with passing more than 1 query string parameter in the streamscript url and I should have it all working.
Hi I got the same problem as Ralph. But I can not get it work. I am storing swf files in DB, then I expose them through aspx page as binary stream. /If I test the stream with avi file form DB and change MIME type to "video/avi" streaming is working( In Windows media player)/ But If I change in streaming aspx page MIME type to : "video/x-flv" and try to stream swf file through swfobject (located on a different page) it does't work. Movie didn't get load. I took off the file variable and I tryied to put the "streamscript" variable to the object (according Ralph's suggestion), but no success.
Here is my SWFObject:
<script type="text/javascript"> var so = new SWFObject('MediaFolder/mediaplayer.swf','mpl','320','270','8'); so.addParam("allowfullscreen","true"); so.addVariable("streamscript", "http://localhost/stream.aspx?swf=1"); so.addVariable("enablejs","true"); so.addVariable("javascriptid","mpl"); so.addVariable('width','320'); so.addVariable('height','270'); so.write('player'); </script>
Please, can anybody tell me, hot to play swf files stored in DB through the SWFobject? Thank you. Petr
Are you just changing the MIME type, or do you actually have a valid FLV file stored in your DB. Streaming only works on FLV files, not swf files. I just wanted to clarify your definitions first, then we can try to understand more.
BTW - the issues you are having should be raise on the JW player page, not on SWFObject, because if your player controls are being displayed, then SWFObject is doing its job as intended and there is no problem there...
HI Guys, so I'm trying to do something similar with a player my team created and the logic with this player is that it also has a place below the main video playing screen that will have about 4 thumbnail previews to other videos that when clicked it will play the video
Now, the code I have thus far embeds the player on my webpage and right now I have the video path, title, description etc.. but ultimately that info will be pulled from my database dynamically....
The part I'm having trouble with is the javascript to play those multiple videos and understanding the syntax... because i'm not really familiar with javascript just the basics, but you see I have variables declared for each of the videos 5 all together. I'm not sure what to do within my code to play the videos.
So this is what I have so far: Any help would be appreciated.
<div id="flash_player"> <strong>You need to upgrade your Flash Player</strong> This is replaced by the Flash content. Place your alternate content here and users without the Flash plugin or with Javascript turned off will see this.
</div>
<script type="text/javascript"> var so = new SWFObject("flash/recipe_videoplayer.swf", "Recipe Video Player", "378", "509", "8", "#000000"); so.addParam("wmode", "transparent"); so.addVariable("preloadimage", "<%=imagePath%>"); so.addVariable("morevideolink", "/devel/cooksdev/video/video.asp"); so.addVariable("savelink", "javascript:saveVideo(1);"); so.addVariable("1flv", "<%=videoPath%>"); so.addVariable("1title", "<%=documentTitle%>"); so.addVariable("1deck", "<%=dek%>"); so.addVariable("1thumb", "images/flash/thumb_mashed.jpg"); so.addVariable("2flv", " flash/flv/pulledpork.flv"); so.addVariable("2title", "Pulled Pork"); so.addVariable("2deck", " This video is about pulled pork."); so.addVariable("2thumb", "images/flash/thumb_pulledpork.jpg"); so.addVariable("3flv", " flash/flv/coqauvin.flv"); so.addVariable("3title", "Coq Au Vin"); so.addVariable("3deck", " This video is about coq au vin."); so.addVariable("3thumb", "images/flash/thumb_coqauvin.jpg"); so.addVariable("4flv", " flash/flv/corn.flv"); so.addVariable("4title", "Corn on the Cob"); so.addVariable("4deck", " This video is about corn on the cob."); so.addVariable("4thumb", "images/flash/thumb_corn.jpg"); so.write("flash_player");
SWFObject just embeds the SWF in the HTML (with optional parameters/variables, if desired); it doesn't control the video.
Playback is handled by the video player Flash file. If your custom player is not configured to handle this, I suggest using a video player that is known to work well, such as the JW Player http://www.jeroenwijering.com/?item=JW_FLV_Player
Unfortunately, this forum is just for SWFObject, and is not the right place to get advice about how to write the ActionScript in your player. You might want to check Flash forums such as kirupa.com and actionscript.org; they're usually pretty helpful with these kinds of topics.