Juan Andres
Juan Andres

Reputation: 433

Prevent video from pre-loading on website

I have the following code for a video on my website. I have the AutoPlay turned off in order to prevent playback as soon as I open the website. The problem is that the video still loads automatically and this hurts the bandwidth of some visitors. What can I do to prevent the video from loading until the user decides to play it?

<object width="530" height="405" scale="to fit" hspace="10" border="5">
<param name="VideoTitle" value="/urlpath/movie.m4v" />
<param name="AutoStart" value="False" />
<param name="ShowControls" value="True" />
<param name="ShowStatusBar" value="True" />
<param name="ShowDiplay" value="True" />
<param name="AutoRewind" value="True" />
<embed width="530" height="405" scale="tofit" hspace="0" filename= "/urlpath/movie.m4v"
    autostart="False" showcontrols="True" showstatusbar="True" showdiplay="True"
    autorewind="True" border="1" src="/urlpath/movie.m4v"></embed>
</object>

Thanks in advance.

Upvotes: 0

Views: 249

Answers (2)

Casey Dwayne
Casey Dwayne

Reputation: 2169

As Diodeus said, have it load "on-demand" by creating a javascript function.

Alternatively, I think you could use HTML5's video tag and leave preload off.

-- The Javascript solution is more friendly for older browsers, as not all support HTML5.

Upvotes: 0

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114367

Don't include the code in your page. Inject it into the page once the user clicks a fake PLAY button.

Upvotes: 2

Related Questions