0

I have the page with YouTube video (object - not iframe) and need to add the image over it. All works fine in Chrome, but in IE the image is below the YouTube player. So I searched for the info and found that for IE I need to add param wmode="opaque" inside the youtube's <object>.

For some reason, I can't add that parameter right into HTML, I need to do it after the page is rendered. So I am doing this:

Example page after rendering:

<span class="video">
<object type="application/x-shockwave-flash" style="width:521px; height:427px;" data="http://www.youtube.com/v/sP5ntTD2ta0">
<param name="movie" value="http://www.youtube.com/v/sP5ntTD2ta0" />
</object>
</span>

I am adding this after document is loaded:

$('.video object').append('<param name="wmode" value="opaque"/>');

But the image in IE is still below the YouTube player.

I think that I need somehow to re-render the page, but how? (I've already tried to use wrap(), unwrap() - no success, sorry I am "green").


Since your Java class doesn't resemble your JSON in any way, shape or form ... you're going to have a problem with that.

  • Problem #1: OperationResult should be an int
  • Problem #2: You're declared ResultData as an Object ... Java doesn't work like that.

You need your POJO to match the JSON:

public class ReturnData {
    public ReturnData() {
        OperationResult = Result.Failed;
        Messages = "An Error Occured";
        UpdateAvailable = "0";
        ResultData = "";
    }

    public int OperationResult;
    public String Messages;
    public String UpdateAvailable;
    public MyResultData ResultData;
}

class MyResultData {
    public String SessionId;
    public String UserName;
    public String AccountId;
    public List<String> Roles;
    public String DisplayName;
    public int Status;
    public int Type;
}

ReturnData rd = new Gson().fromJson(jsonString, ReturnData.class);

I'd also consider using Gson's @SerializedName("name") annotation to convert the PascalCase field names in your JSON to camelCase field names in Java.

@SerializedName("OperationResult") public int operationResult;
4

1 回答 1

0

您可以尝试使用 HTML5 视频标签。

<video id="video" width="521px" height="427px" controls="controls" preload="auto">   
    <source src="http://www.youtube.com/v/sP5ntTD2ta0" /> 
</video> 

这使得元素的样式以及您放置在其顶部的其他 div 更容易。

http://www.w3schools.com/html/html5_video.asp

于 2013-03-06T15:38:12.680 回答