Everyone is familiar with the situation when you want to cancel a running YouTube video (or another video host), if it was launched by mistake or a further viewing is not interesting. Currently, there is no possibility to cancel the download via the player. Even if you stop the video - it will continue loading until the end.
While Youtube didn’t add a “cancel download” button to the embeded player, site owners can use a little trick and implement such a button on their own.
* We consider Youtube.com as an example, although the principle also works for other services.
')
Below is a working example, if you copy it into an HTML file, save and run it will work.
A small explanation: when adding a video to a site, you can use something like this [youtube] dMH0bHeiRNg [/ youtube]
The parsing script should convert it into a form that is specified inside the “Automatically generated content” block, that is, simply take this template and in the right places instead of the label (choose yourself) insert the video code, in our case “dMH0bHeiRNg”.
In addition, where it is convenient for you, you need to declare a function youtube_video_init () on the site.
The principle of operation is as follows - the user presses the Play button - the video begins to load. The user presses the “Cancel download” button, while the block contents are being overwritten by themselves, the flash player acquires its original appearance, the download stops.
You can develop a thought, and try to stop loading by controlling only the properties of the page objects.
Have a nice work.