Description
With the traditional Video Player, you need to manually inject your video's url into the html code. This also means you need an individual code block for each song you want to play.
This is very tedious, and frankly, too complicated for less advanced users. So I've expanded upon the original code, and made it possible to dynamically play videos as specified in the URL:
This is the code that does all of the hard work. You should never need to use this code.
<html><head><metahttp-equiv="Content-Type"content="text/html; charset=iso-8859-1"/><title>Video Player</title><!-- © James Kanjo 2009 --></head><body><scripttype='text/javascript' src='http://snippets.wdfiles.com/local--files/code:video/swfobject.js'></script><scripttype="text/javascript"> var url_params = /^#([^#]*)(#autoplay)?$/; var match = url_params.exec(unescape(window.location.hash)); if (match) { document.write('<pid="preview"><i>Flash has been disabled, or is not installed. This video player requires <atarget="_blank"href="http://get.adobe.com/flashplayer/">Flash</a> to function.</i></p>'); var s1 = new SWFObject('http://snippets.wdfiles.com/local--files/code:video/player.swf','player','400','300','9'); s1.addParam('allowfullscreen','true'); s1.addParam('allowscriptaccess','always'); if (match[2]) { match[1] = match[1] + '&autostart=true'; } s1.addParam('flashvars','file=' + match[1]); s1.write('preview'); } else { document.write('<i>Invalid URL syntax</i>'); } </script><noscript><i>Your Javascript has been disabled. This video player requires Javascript to function.</i></noscript></body></html>
Don't worry if looking at that scares you. You actually don't need to use it in your wiki at all.
Code
The video player can play *.flv files and H.264 encoded files.
[[iframe http://snippets.wdfiles.com/local--code/code:video#VIDEO-URL frameborder="0" scrolling="no" height="320px" width="440px"]]
To make the player automatically start playing when the page loads, just append #autoplay to the video's URL. For example:
[[iframe http://snippets.wdfiles.com/local--code/code:video#http://squark.wdfiles.com/local--files/dev:9/video.flv#autoplay frameborder="0" scrolling="no" height="320px" width="440px"]]
In action
[フレーム]
Thanks to tsangk for this great snippet: conditional-blocks
text above inserted with:
[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]
Other snippets posted by James Kanjo
Rate this solution
If you think this solution is useful — rate it up!
It seems the height and width options don't work. Any ideas? Also, is there a way to force the video to start in full screen mode? I've got a video running for my upcoming Haunted House volunteer project.
Thanks,
George
United Volunteers of Maine
See our Haunted House info at: http://uvm.wikidot.com/projects-hh/
I can create the same video as a avi, perhaps I could upload that to Youtube and embed from there?
- Rob, which SWF/FLV player do you use?
~ Paul
It seems to be having problems playing my .swf file. When you click play to says '10' with the spinning circle, nothing happens.
Template: http://hobstarcs.wikidot.com/video:_template
In action: http://hobstarcs.wikidot.com/video:1
Actual file: http://hobstarcs.wikidot.com/local--files/video/How-To-Upload_Images.swf
File seems to be fine, need a little help please. :)
It would be easier to help if you had page options turned on so we could view source, files, etc.. In looking at the HTML source, I see you're using a SWF instead of an FLV. Most SWF files require a separate FLV file unless you create the SWF so it has the video and player in the same file. I also found a small typo when viewing the HTML source:
<iframe src="http://snippets.wdfiles.com/local--code/code:video#http://hobstarcs.wikidot.com/local--files/video/How-To-Upload_Images.swf" align="" frameborder="0" height="400px"" scrolling="no" width="500px" class="" style=""></iframe>
There's an extra " in the height parameter. I doubt that's breaking things, but you never know…
I can try this later today with a variety of SWF/FLV files to see if I can narrow it down.
-Ed
I downloaded the swf to my site and tried to play it with the SWF/FLV player I normally use (I don't use James' snippet). However I am getting an error message from Flash Player 10 so something seems to be wrong with the source. You might try re-creating the swf file if you can.
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.