0

There is a site containing an embedded youtube video and whose source code is

<object width="300" height="200" 
   data="http://www.youtube.com/embed/G7S5GEp****" 
   type="application/x-director">
<param name="url" value="http://www.youtube.com/embed/G7S5GEp****" />
<param name="src" value="http://www.youtube.com/embed/G7S5GEp****" />
<param name="sound" value="true" /><param name="progress" value="true" />
<param name="autostart" value="true" />
<param name="swstretchstyle" value="none" />
<param name="swstretchhalign" value="none" />
<param name="swstretchvalign" value="none" /></object>

The problem is that Opera and Chrome do not play this video showing the gray screen stating that "This plug-in is not supported" instead of the video. At the same time IE and Mozilla Firefox play the video without any problem. I check the behavior for the video and the browsers on two different PCs.

  1. I found that application/x-director is an Adobe Shockwave Player video. So I thought that this is the problem. However, IE and Firefox play the video without Shockwave installed on my PC. I tried to install Shockwave but Chrome and Opera do not see the Shockwave plugin in their chrome://plugins or opera://plugins and still do not play the video.

  2. Then I found that when I watch the video using IE or Firefox and click on it with the right button of the mouse I get the menu where it's written "About the html5 player" and when I go to the page I get to youtube page explaining html5 and checking my browser for html5 support (my browsers are up-to date and support it).

    I also found the SO question Embedding a shockwave file in HTML5 where it's told that the syntax of my video is the HTML5-syntax:

<object data="..." type="application/x-director" ...></object>
  • So I can't understand if my video is a Shockwave video or a HTML5 video? And how can I make Chrome and Opera to play it correctly?
  • As I can see this source code can't be played by many browsers by default. What is the best way to insert a youtube video into a site page in order it to be played correctly by most of browsers? (as far as I understand, it should be a html5-video as many browsers tend to stop supporting Adobe Flash products)?

I would be so grateful to get any help. Thank you for attention!

Community
  • 1
  • 1
JenyaKh
  • 2,040
  • 17
  • 25

1 Answers1

1

What is the best way to insert a youtube video into a site page in order it to be played correctly by most browsers?

Most browsers expect a video file to be put in a video tag. Since you are using Youtube, you have a page link (http) not a video file (mp4) so you must load the page within an i-frame. When Youtube servers see the request, they will return a video player for that link...

Replace your shown <object>-based code block with this <iframe> version...

<iframe width="300" height="200"
src="https://www.youtube.com/embed/G7S5GEp****">
</iframe>

Also regarding...

  • application/x-director is a small mistake by them, should be application/x-shockwave.
    It's small because it doesn't stop the machine running...

  • <object> tag is NOT for embedding http links. To embed Flash apps put a link to the SWF file (output of Flash) as input source. For example : If Android apps could be embedded in browser they too would go into <object> where data="mysite/myapp.APK"...etc

  • Using youtube.com/embed/ gives an HTML5-based player (for <iframe> tag),

  • Using youtube.com/v/ gives a Flash-based player (for <object> tag).

  • Also for Flash, setting width="300" height="200" is too small for input coming from another server, it will be blocked by especially Chrome since it notices that it's a banner size (Flash adverts are auto-blocked). Must have a minimum width="800" height="600" or else the only fix here is that Youtube SWF app (or any other SWF) must exist at same folder as your html files in your own server.

VC.One
  • 14,790
  • 4
  • 25
  • 57
  • Thank you very much for so much useful information! So, do I conclude right that Chrome and Opera do not play the video because the html is just wrong (object tag is used instead of iframe)? But Firefox and IE, why are not they get broken with this wrong youtube link embedding? – JenyaKh Dec 14 '16 at 07:08