1

I have a html page that use flash object with html5 fallback to play medias. What I have observed when loading the page is if the browser supports the provided html5 video type, regardless flash installed or not, the html5 video will always be downloaded.

In my opinion, this is a total waste because if your browser support flash, you will never be able to fallback to html5, however, the whole html5 media is still downloaded. It also may affect the viewing quality of your flash when your network condition is not well.

Also, further to my previous question Both player will playback if set html5 autoplay to be true when using flash to html5 fallback, I have use

$(document).ready(function(){
        if (swfobject.hasFlashPlayerVersion("9.0.18")) {
                        var video = document.getElementsByTagName("video")[0];
                        var audio = document.getElementsByTagName("audio")[0];
                        if (video != null) {video.parentNode.removeChild(video);}
                        if (audio != null) {audio.parentNode.removeChild(video);}
        }
    });

to detect the flash version of browser. If the browser supports flash, then the video/audio part will be removed from html page.

It seems to partially solve my question, as the download will be halted half way through, but I still don't think this is a good solution since the media is still be partially downloaded.

I would like to know if anyone have some insights in this area?

Thank you!

Community
  • 1
  • 1
Yudong Li
  • 1,784
  • 2
  • 17
  • 32

2 Answers2

0

Perhaps get rid of the ready, and just do on page load, so that it is not waiting for everything else before working out if flash is present.

However personally, have you considered doing it the other way round, and falling back to flash if HTML5 is not supported?

Take a look at This as it is similar to what you are looking for.

1321941
  • 2,139
  • 5
  • 26
  • 49
  • Thanks for your reply. No we don't want to fallback to flash but html5 as a preference because we have a lot of branding needs to do with flash. Also, from my understanding, onload() will be called even later than jQuery's document.ready(). When you said to do it on page load, can you please clarify what method/event handler you referred to? – Yudong Li May 28 '12 at 07:21
  • Perhaps the html5 event handler: onloadstart? – 1321941 May 28 '12 at 17:39
0

Use CSS to set the display property of the video object to "none". The video will not load if it is not visible. After you have checked for flash you can set it to show via JavaScript and it will start loading.

Flassari
  • 1,149
  • 8
  • 13