How to determine when an embedded Flash object is loaded?

When embedding a flash object, is there a way to determine when it is fully loaded?

This is my main question, but for anyone interested in the details:

I am using the ( DOMWindow ) jQuery plugin. For those unfamiliar, this is a basic overlay that seems to be centered on the page, primarily the rest of the content, which is darkened.

Inside DOMWindow I have embedded a YouTube video. The markup used to embed the video is introduced by AJAX.

DOMWindow has a built-in download schedule, but the problem I encountered is that the AJAX GET request is completed almost instantly, and within 3-5 seconds I get stuck looking at the white rectangle, waiting for the YouTube video to download.

If I could figure out how to determine when it finished loading, I could code a more elegant loading scheme (using an animated counter) inside DOMWindow.

+2
source share
3 answers

You should take a look at this Youtube Player Javascript API page . Signing the onStateChange event and looking for it to return 5 is what you want to do.

I will leave my initial answer, in case it is still convenient. He is lower.

. Flash- javascript . , , . , YouTube.

+2

Flash, Flash OnProgress, OnReadyStateChange PercentLoaded JavaScript OBJECT EMBED. http://www.adobe.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_03.html

+1

- - Flash, ( API YouTube).

In addition, there is no objective point when the Flash movie download is completed. After loading the first frame, it can display the initial content, and then load the contents of the content, and even if the root SWF file is loaded, it may need to load more external content before it can display anything. (YouTube probably falls into this latter category, like any service where content is uploaded by the SWF container.)

0
source

Source: https://habr.com/ru/post/1763009/


All Articles