Saturday, January 14, 2012

[YouTube-API] IFrame API on iOS: Removing Title Bar?

I'm using the IFrame API in an iOS application and it's working wonderfully, giving me callbacks, etc. However, the title of the video appears on the player, much to my chagrin. Not only do I not want the UI of the title bar (I display the title immediately above the video), but clicking the title actually takes the user to the mobile YouTube page for the video. Since I put it in a small frame, it's then difficult for users to press the Play button (not to mention an additional click). I was able to get around this by redirecting "m.youtube.com" requests to send a JavaScript command to play the video, but I'd like to remove the video's title altogether. Here's how I create the video player:

<body style = "margin: 0px 0px 0px 0px;">
<div id="player"></div>

<script type="text/javascript">
var player;
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '100%',
width: '100%',
videoId: '__VIDEO_ID__',
events: {
'onStateChange': onPlayerStateChange,
'onReady': onPlayerReady,
'onError': onPlayerError,
'onPlaybackQualityChange': onPlaybackQualityChange
}
});
}

I've tried setting "controls" to 0, "modestbranding" to 1, and "showinfo" to 0, but none worked. Any ideas?

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/OQXICOrNBqQJ.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment