What HTML code do I need to get Adobe Flash to play an embedded MP4 video file (8 MB)?
Thanks
Mark
Here are a couple of ways, one using the Netstream class and the other using the FLVPlayback component.
For the NetStream approach, the following in the timeline code will play/loop the intended mp4 file...
var video:Video;
var connect_nc:NetConnection = new NetConnection();
connect_nc.connect(null);
var stream_ns:NetStream = new NetStream(connect_nc);
stream_ns.client = this;
function netStatusHandler(p_evt:NetStatusEvent):void {
if (p_evt.info.code == "NetStream.Play.Stop") {
stream_ns.seek(0); // to loop the video
}
}
stream_ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
video = new Video();
addChild(video);
video.attachNetStream(stream_ns);
stream_ns.play("path_to/your.mp4");
For the FLVPlayback component, add it to the stage, give it an instance name ("fp" used below), assign your mp4 file ("path_to/your.mp4") as the source property in the Properties panel, and select the option to autoplay as well. Place the following code in the timeline...
fp.addEventListener(Event.COMPLETE, playAgain);
function playAgain(evt:Event):void {
fp.play();
}
To put the Flash swf file in an html page, in the Publish Settings set it to publish an swf and an html page. Publish the file an the html page will be created for you.
Thanks.
I don't have any actual Adobe developer programs. I am just relying on client PC's using Google Chrome and having Flash installed.
So I was just after the code I would need to add to my html page in order for it to play an embedded video (mp4 format) with the client PC's Adobe Flash.
I can't use HTML5 <video> because it has been unreliable for us on Windows 7/8 machines running Chrome to date. E.g. squashes video vertically, sometimes hasn't been loading etc.
I am using .net Visual Web Developer as the aspx page authoring program.
I assume the NetStream approach you gave is Javascript that will work inside:
<script type='text/javascript'>
</script>
TIA
If you do not have Flash such that you can create a Flash file that plays a video or do not have a video player swf made using Flash, you can't embed what you don't have.
You asked for a Flash solution for which I gave you two. NetStream is not javascript, it is Actionscript, the coding language of Flash.
There are many video players that can be "embedded" on an HTML Web page, many which even give you the code that you simply "copy/paste" into your existing HTML code.
For example:
or
http://www.longtailvideo.com/jw-player/
or
plus many others... A simple Google for "Flash Web video players" will get you lots of results.
My choice is the JW Player, which plays on PCs as well as iProducts... something that a "Flash only" player will not do.
Best wishes,
Adninjastrator
North America
Europe, Middle East and Africa
Asia Pacific