Broken player from generated embed code (fullscreen doesn't work)

mrfelton - May 18, 2009 - 14:16
Project:FLV Media Player
Version:6.x-1.0-beta3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Currently, flvmediaplayer generates an embed code that looks a little like the following:

<object  width="600"  height="300">
  <param name="bgcolor" value="#000000"></param>
  <param name="height" value="300"></param>
  <param name="width" value="600"></param>
  <param name="allowfullscreen" value="true"></param>
  <param name="quality" value="true"></param>
  <param name="allowscriptaccess" value="always"></param>
  <embed src="http://www.example.com/mediaplayer.swf" flashvars="background=#000000&frontcolor=#ffffff&lightcolor=#ffffff&screencolor=#000000&height=300&width=320&playlist=right&playlistsize=280&skin=http://www.example.com/skins/modieus.swf&repeat=none&stretching=fill&volume=90&file=http://www.example.com/xspf" width="600"  height="300"></embed></object>

The problem here is that some attributes are missing from the tag, and only included as elements. I don't think this is right. For one thing, 'allowfullscreen' needs to be set as an attribute on the tag, otherwise it just doesn't work (in Firefox on Linux anyway). The attached patch ensure that these params are also included as attributes on the embed object, thus ensuring that the user gets a fully functional embeded player from the embed code. After installing the patch, the above embed code would look more like this:

<object  width="600"  height="300">
  <param name="bgcolor" value="#000000"></param>
  <param name="height" value="300"></param>
  <param name="width" value="600"></param>
  <param name="allowfullscreen" value="true"></param>
  <param name="quality" value="true"></param>
  <param name="allowscriptaccess" value="always"></param>
  <embed src="http://www.example.com/mediaplayer.swf" bgcolor="#000000" height="300" width="600" allowfullscreen="true" quality="true" allowscriptaccess="always" flashvars="background=#000000&frontcolor=#ffffff&lightcolor=#ffffff&screencolor=#000000&height=300&width=320&playlist=right&playlistsize=280&skin=http://www.example.com/skins/modieus.swf&repeat=none&stretching=fill&volume=90&file=http://www.example.com/xspf" width="600"  height="300"></embed></object>

This assumes that you have first applied my patch from #450868: Fullscreen and Autostart do not work to get fullscreen support working in the firstplace!

AttachmentSize
flvmediaplayer-embed-params-vars.patch1.88 KB

#1

arthurf - May 19, 2009 - 16:59

I don't think this is correct. Please review:

http://code.google.com/p/swfobject/wiki/documentation

#2

mrfelton - May 19, 2009 - 20:55

For SWFObject, sure... but we are generating embed code here - that is, code that someone is going to copy and paste into their own website. Are you saying that it is a requirement for them to use SWFObject to embed it?

Go to the JWPlayer setup wizard (http://www.longtailvideo.com/support/jw-player-setup-wizard), and look at the 'embed code' they generate (this is different from the swfobject code)

<embed
  src="/jw/embed/player.swf"
  width="470"
  height="320"
  bgcolor="#ffffff"
  allowscriptaccess="always"
  allowfullscreen="true"
  flashvars="file=http://content.longtailvideo.com/videos/flvplayer.flv"
/>

#3

arthurf - May 20, 2009 - 13:47

Looking at youtube's code:

<object width="560" height="340">
  <param name="movie" value="http://www.youtube.com/v/h_KIqdS1SO0&hl=en&fs=1"></param>
  <param name="allowFullScreen" value="true"></param>
  <param name="allowscriptaccess" value="always"></param>
  <embed src="http://www.youtube.com/v/h_KIqdS1SO0&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed>
</object>

It looks like there are some specific elements that need to be rendered differently (movie always, allowFullScreen and allowscriptaccess if they are set).

My guess is that for browser compatibility (IE?) these are needed for the youtube player... Not sure about the JW player though. From what I understand, for validation to work, you need to wrap the embed object in the object tag

#4

mrfelton - May 20, 2009 - 17:46

I really haven't looked into this in too much detail, but what I do know for sure is that without allowfullscreen="true" set on the embed, fullscreen does not work with JW Player on FF/linux and IE/Windows XP. I possibly went overboard by just including all the attributes on the embed tag, but I just needed to get it working and that was simple to do and did the trick. As I understand it, the tag is for some browsers, and the embed is for those that do not support , like IE.

#5

arthurf - May 26, 2009 - 18:12

Is the issue maybe the capitalization with allowFullScreen ?

 
 

Drupal is a registered trademark of Dries Buytaert.