Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US :: FAQ
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
ADOBE FLASH:HomeFlash ForumFlash TutorialsFlash Video TutorialsWeb Streaming ForumAdobe FlashPodcast

Problems getting SWF to not auto-play on page load.

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook
Jack JosephyProblems getting SWF to not auto-play on page load.
by on Nov 26, 2009 at 5:55:04 pm

First of all let me say I have no Flash experience. I know some javascript and I'm completely profecient at XHTML and CSS, but I don't know anything about actonscript yet and my knowledge of video formats is limited

I have been trying to embed an .SWF file in a website. The file was given to me by someone else (whos knowledge is even more limited than mine) along with the embed HTML code. It had been published in Adobe CS3 from a F4V file and had no skin or controls.

I managed to get the video playing using a standard HTML embed technique.

However using play="false" in the and similar commands would not stop it auto-playing. I literally tried everything and followed loads of forum discussion threads. I figured it could be something to do with my version of Firefox (3.5) because thats what I was testing in, so I tried it in IE with no fix of the problem still.

Then I did some research and found out about swfobject.js. http://code.google.com/p/swfobject/

I figured this was a better technique anyway, particularly for browser cross compatibility and SEO, and managed to get the video playing using the SWFObject dynamic publishing technique.

However I still had no control over - var params = {Play: "false"} - even though params such as - {wmode: "transparent"}; - were working fine.

This has led me to the conclusion that the auto-play function is hard coded into the .swf file.

My first question is:

1.Do functions like auto-play get hardcoded during the FLV to SWF conversion process in adobe CS3 or when exporting?

2.If so what do I need to do in Flash CS3 to get a copy I have control over whether it plays or not on load (and loops). I have access to a copy and had a look earlier, but didn't really know what I was doing and couldn't find where to change the auto-play and loop params.

3.If not does anyone know what else my problem might be?

What I want is for the page to load up. I have a content box 890x500 (same size of the video). The first frame of the video will lie on the left of the content box with html text on the right, when the page loads. The user then clicks on the video, the html fade text fades out (using some javascript) and the video begins. They watch the video, then the text fades back in and the video stops.

Below is my current script: for the swfobject













Alternative content







Note: I have omitted irrelevant tags for privacy reasons.

One other thing... When I uploaded to the server, the page was taking about a minute before it loaded and the video started. I presume its loading the entire video first (18mb) rather than buffering incrementally. Why is this?

Thanks for any tips and solutions in advance


Return to posts index
Reply   Like  

Marcus GeduldRe: Problems getting SWF to not auto-play on page load.
by on Nov 28, 2009 at 9:11:51 pm

You are right in assuming that the autoplay option is compiled into the swf. Using Actionscript, it's possible to create a swf with an autoplay option that is controllable via vars passed by HTML, but you can't do that without programming.

So you'll need to re-import the FLV and tell it what autoplay option you want. (Click on the video-player on the Stage and choose Window > Component Inspector. You'll see an auto-play option.)

To answer your second question, it sounds like someone chose the wrong option when importing the video. Basically, you have three options:

1) Embed the video inside the SWF (on the Timeline).
2) Keep it and external file (progressive download).
3) Host it on a streaming service, e.g. Flash Communication Server.

The first option is almost ALWAYS bad.

If you choose option two (the most common), you should end up with two files, the swf and the FLV/F4V. If you choose option one, you'll only have one file, because the FLV will be embedded in the SWF.


Author "After Effects Expressions"
Co-author "After Effects For Flash, Flash For After Effects"
Artistic Director, Folding Chair Classical Theatre, Inc
Senior Flash Developer, Zeitbyte.com


Return to posts index
Reply   Like  
+1

Jack JosephyRe: Problems getting SWF to not auto-play on page load.
by on Nov 29, 2009 at 4:20:19 pm

Ok so I have realised my client will need a progressive download. The videos for each page are approximately 1-2 mins and it needs to run seamlessly and load quickly as the videos are their product.

So I tried importing a .FLV into Adobe CS3 and I followed these instructions

http://www.russellchun.com/flash/videoprogressive.html

So this gave me an FLV with some edited parameters (auto-play off, loop off) and action-script: stop()
with an SWF skin/player: ClearOverPlayMute.swf

I exported the flv to swf in Flash CS3 (Was no option to save or export as flv)

Then used a program to convert it back to flv.

Then used an html code, adding flashvars params for the flv to the usual swf embed code, with both flv and swf in the same file directory. I reverted back to the traditional html embed technique rather than swfobject but presumably you can use swfobject. This is the html code I borrowed: http://www.movavi.com/suite/howtos/FLVcode.html

The video would no longer play at all when I tested in the browser. The content box was just blank, with no first shot of the video. I didn't try uploading and testing on the server, but it shouldn't make any difference.

It also wouldn't work when I tried to Control>Test in Flash CS3. Just a still picture of the first shot and no sign of a controller skin. Though if I turned auto-play on and removed the stop() action-script it ran fine in the Flash test environment.

Once again I seem to have no control of play-back and this time I have no video at all.

I definitely need a progressive download technique, because customers can't be waiting a minute for the page to load as will be the case with a straight up swf embed.

This is what the final implementation should do:

1. The page loads and the first frame of the video lies on the page in the content box (890x500), with html text overlaid on top of the video on the right.

   2. The user clicks on the video, the html text fades out, the video plays.

   3. The video plays through, stops, fades out. .

   4. Both the first clip of the video and the original html text fade back in.

   5. The user is now free to play the clip again (step 2) or navigate to another page.

(So in addition to my main query I need a communication between the video and Javascript/J-query. Any tips on this? )

And more importantly any ideas on why my progressive download technique won't work. Once again I think it may be to do with early encoding in Flash because it wasn't working in the flash test environment.

Thanks in advance




Return to posts index
Reply   Like  


Marcus GeduldRe: Problems getting SWF to not auto-play on page load.
by on Nov 29, 2009 at 7:52:56 pm

I don't think you can do what you want with the first frame. When one of my clients wants a single frame to show as a still, I always have to export a screenshot of that frame as a jpg or png and use that, instead.

Author "After Effects Expressions"
Co-author "After Effects For Flash, Flash For After Effects"
Artistic Director, Folding Chair Classical Theatre, Inc
Senior Flash Developer, Zeitbyte.com


Return to posts index
Reply   Like  

Marcus GeduldRe: Problems getting SWF to not auto-play on page load.
by on Nov 29, 2009 at 8:01:17 pm

I have tried to answer your questions, below. I can't think of a way to do this without a lot of coding which may be beyond your skill level (sorry if this is a false presumption).

By "a lot of coding," I mean a couple of hours for a seasoned coder. You can probably find someone who will do it for you for a small fee.


1. The page loads and the first frame of the video lies on the page in the content box (890x500), with html text overlaid on top of the video on the right.

- load in a fake first frame (actually a jpeg) using the Loader class.
- add in a textfield on top of it with the html text.
- add an event listener to the frame image, making it a button.


2. The user clicks on the video, the html text fades out, the video plays.

- in the event handler function, play a video that has been set to pause by default.

3. The video plays through, stops, fades out. .

- add a listener to detect when the video is complete so that you can run a tween script to fade it out.

4. Both the first clip of the video and the original html text fade back in.

-Also in the handler, tween the frame and the text back in.

5. The user is now free to play the clip again (step 2) or navigate to another page.

(So in addition to my main query I need a communication between the video and Javascript/J-query. Any tips on this? )

- Use the ExternalInterface class


Author "After Effects Expressions"
Co-author "After Effects For Flash, Flash For After Effects"
Artistic Director, Folding Chair Classical Theatre, Inc
Senior Flash Developer, Zeitbyte.com


Return to posts index
Reply   Like  

Jack JosephyRe: Problems getting SWF to not auto-play on page load.
by on Nov 29, 2009 at 10:03:54 pm

Ok I understand the logic of the solution and with a bit of research I should be able to implement it. I thought originally I might be able to put a JS event listener on the first and last video frame so I could pass a command onto J-query for html text fades. But sounds like I need to learn some action script to use ExternalInterface class. I already know a bit of Javascript and I hear action script is pretty easy to pick up. If it takes me a few days, it takes me a few days. I am still learning to web develop and action script is somthing I ought to learn.

That solves that issue, but I still need to get the flv video working first so that it doesn't auto play and so I have control on it, when I turn auto-play off before exporting in FlashCS3.

This is a really basic question, but I am new to video embedding and trying to work the problem I have bottom up, so can you clear this up:

For progressive download (and what I need) I want a .FLV file of the video I want to embed with stop() actionscript coded before the first frame and auto play parameter turned off. Plus some sort of swf container for the FLV to play in.

So I have a "video.flv" file and a "ClearOverPlayMute.swf" file, which are placed in the same directory and then I use the html embed code linked to these two files so the video is embedded in the page and can be played

Is the skin you choose when importing the video in Flash all you need in terms of an SWF container or is it just a controller skin? It will be fine if the call to action is clicking the play button of the skin, as long as it can link to the div with html text to make it fade out (and back in at the end). If not can you point me to a free swf container I can download and use to play the flv and access through the externalnterface class.

Theres so much documentation out there, its difficult to know exactly where to start, but I am making progress, so if you can verify the above it would be great.

thanks again


Return to posts index
Reply   Like  


Marcus GeduldRe: Problems getting SWF to not auto-play on page load.
by on Nov 29, 2009 at 11:18:27 pm

Okay, I might be able to clear up some confusions.

So a Flash file only has one type: the SWF. In other words, any time anyone says they're embedding Flash on their website, they mean they are embedding a SWF file (if they know what they're talking about).

You can not embed an FLV on your site. An FLV can only play through a SWF. In other words, web browsers have no ability to read or playback FLV files -- only SWF files. Luckily, browsers CAN play SWFS, which can in turn play FLVs:

FLV---SWF---HTML---BROWSER

SWF files are not just for video. SWF files are all-purpose containers that can hold (or link to and play back) graphics, text, audio and video. You are just choosing to use a SWF to play video.

SWFs can also act as projectors as other SWFS:

SWF--SWF--BROWSER

Or a SWF can play another SWF and a video:

SWF---> SWF <----FLV
.................|
.................|
..............BROWSER

This is the case you're dealing with (or should be dealing with). The "skin" file, ClearOverPlayMute.swf, contains the "vcr controls" (the play button, etc.), the FLV is the video, but you're missing one file: the main SWF that plays back both the skin SWF and the FLV.

You can't just join these two by using Javascript. They must be joined together by a main SWF, the one played by the browser.

As for Actionscript, version 1.0 was similar to Javascript. Versions 2.0 and 3.0 (especially 3.0) are much more like Java. As an Actionscript developer, I can easily understand Java books. But the language is moving a bit far away from Javascript.

Author "After Effects Expressions"
Co-author "After Effects For Flash, Flash For After Effects"
Artistic Director, Folding Chair Classical Theatre, Inc
Senior Flash Developer, Zeitbyte.com


Return to posts index
Reply   Like  

Marcus GeduldRe: Problems getting SWF to not auto-play on page load.
by on Nov 29, 2009 at 11:20:54 pm

Can you explain the end-result you're trying to achieve without mentioning the technology? I'm a bit confused as to whether you want to see the video play automatically or not -- or whether you sometimes want it to and sometimes don't.

Author "After Effects Expressions"
Co-author "After Effects For Flash, Flash For After Effects"
Artistic Director, Folding Chair Classical Theatre, Inc
Senior Flash Developer, Zeitbyte.com


Return to posts index
Reply   Like  

Jack JosephyRe: Problems getting SWF to not auto-play on page load.
by on Nov 30, 2009 at 12:55:28 am

Ah now I see! Been missing that all along. Was misled to think the ClearOverPlayMute.swf was a skin and container combo.

So how do I get hold of the main SWF to play the flv in the browser?

Also to add I've dabbled in a bit of Java as well as Javascript, so I should pick up the basics of action script fairly easily. I've got a pretty logical mind-set, so its a matter of learning syntax really.

In response to your second post:

What I have is a web page with a 890x500 content box, in which a video of the same size is to be embedded. The video should not play automatically when the page loads. Instead a div of html text lies over the right of the content box. On the left of the box, is a static clip of the video presenter (the first clip of the video). When the user clicks the presenter (or a styled transparent play button), the video starts and the div with html fades out.

(An easy solution to circumvent any interaction of action-script, JS and html would be to just replace the html text with text on the first frame of the video, but obviously this is very poor for SEO and accessibility reasons.)

So to answer your question the user has the choice of whether to play the video or just read the html text. This will be the same for all the main pages of the website. Once I have implemented one page, it will be very easy to repeat the technique for the remaining pages.

I would rather not out source work if I can avoid, because firstly I want to pick up action-script myself and secondly I'm not being paid myself for this project, so I would need to convince my client to pay someone else.

By the way thanks for your posts. you are saving me alot of un-necessary trial and error frustration :)


Return to posts index
Reply   Like  


Marcus GeduldRe: Problems getting SWF to not auto-play on page load.
by on Nov 30, 2009 at 2:34:56 am

I will think about the easiest way to achieve what you want.

In answer to your question re how to get the main swf, you'd create in Flash CS3 or CS4, whichever you have. File > New Flash File (Actionscrpt 3.0)

When you save this file, it will be saved as an FLA file, which is the SOURCE FILE format for Flash.

Choose Modify > Document to set the dimensions you want and then choose File > Import > Import Video. Import your FLV as a progressive video. Choose the skin you want (in the video import wizard) and then choose File > Publish.

Flash will save a bunch of files to the same folder where you saved the FLA, including the two SWFS (the main one and the skin) and a dummy HTML file which you can load into the browser to see the files working.

Author "After Effects Expressions"
Co-author "After Effects For Flash, Flash For After Effects"
Artistic Director, Folding Chair Classical Theatre, Inc
Senior Flash Developer, Zeitbyte.com


Return to posts index
Reply   Like  

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook


FORUMSTUTORIALSFEATURESVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2014 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]