我有一个不使用全屏的网络视图。 我将它设置为在网络视图区域播放视频的 Youtube 视频。 当我改变设备方向时, 视图会调整大小, 但内容不会。 如果我设置比例页面以适应网络视图的旗帜, 它会正确改变方向, 但视频的右侧和底部总是有白色空间, 不论方向如何 。
我怎样才能让视频填满网络视图, 并调整方向, 而不浪费版面。 或者我如何让视频像在iPhone上一样播放全屏( 这会是我一个可行的选择, 跳过布局问题 ) 。
我有一个不使用全屏的网络视图。 我将它设置为在网络视图区域播放视频的 Youtube 视频。 当我改变设备方向时, 视图会调整大小, 但内容不会。 如果我设置比例页面以适应网络视图的旗帜, 它会正确改变方向, 但视频的右侧和底部总是有白色空间, 不论方向如何 。
我怎样才能让视频填满网络视图, 并调整方向, 而不浪费版面。 或者我如何让视频像在iPhone上一样播放全屏( 这会是我一个可行的选择, 跳过布局问题 ) 。
I read this tutorial and was able to solve the problem. http://webdesignerwall.com/tutorials/css-elastic-videos
基本上,您可以将包含项的大小设置为用于肖像的一件事和用于景观的一件事。
还设置对象嵌入代码,使高度宽度达到100%,而不是固定宽度。
这是我的 html :
<span class="youtube">
<object type="application/x-shockwave-flash" id="ytPlayer" style="visibility: visible;" allowscriptaccess="always">
</object>
</span>
这是我的笔记本
var ytswf = document.getElementById( ytPlayer );
var videoID = Nky9omXFZD4 ;
ytswf.outerHTML = "<object height="100%" width="100%" type="application/x-shockwave-flash" data="http://www.youtube.com/v/" + videoID + "&enablejsapi=1&playerapiid=ytplayerObj&rel=0&fs=1&autoplay=0&egm=0" id="ytPlayer" style="visibility: visible;" ><param name="allowFullScreen" value="True" /><param name="allowScriptAccess" value="always" /></object>";
这是我的CS:
.youtube{width:432px; height:245px;}
@media only screen and (orientation:portrait)
{
.youtube{width:702px; height:398px;}
}
我用下面的代码 它对我有用
// css
// You can add your own width and height values or insert this values using stringWithFormat
NSString *css = @"<style type="text/css">
.youtube{width:320px; height:363px;}
@media only screen and (orientation:portrait) {
.youtube{width:320px; height:363px;}
}
@media only screen and (orientation:landscape) {
.youtube{width:480px; height:203px;}
}
</style>
";
// different format of urls for iOS 5 and iOS 6
NSString *src = ([[[UIDevice currentDevice] systemVersion] compare:@"6" options:NSNumericSearch] == NSOrderedAscending)
? @"http://www.youtube.com/watch?v=%@?autoplay=1" // iOS 5
: @"http://www.youtube.com/v/%@?autoplay=1"; // iOS 6
// inserting css in <head> and inserting src
NSString *youTubeVideoHTML = [NSString stringWithFormat:
(@"<html><head>%@</head>
<body style="margin:0">
<embed class="youtube" id="yt" src="%@" type="application/x-shockwave-flash"
></embed>
</body></html>") , css , src ];
// setting YouTube video ID
finalHtml = [NSString stringWithFormat: youTubeVideoHTML , videoID ];
[self.webView loadHTMLString:finalHtml baseURL:nil];
How best to store the html for embedding? the only ways I can think of are: take the embed html and add <?php echo $var1; ?> where the id s go then store it in the db and use Eval to execute ...
Is there any way to open the YouTube app from my app, with a defined search query? If not, is there a way to just open YouTube, without playing any video? All I m finding is ways to play videos.
I need to debug a networking application which handles video downloaded by iPhone from Youtube. iPhone downloads chunks of video by requesting each time a different file range (by adding Content-Range ...
I m trying to work out how to upload videos to YouTube using the api from flash. There seems to be libraries available for doing this with php, ruby, java etc. but not AS3. Can anyone point me in the ...
Is there a way to add a youtube overlay for a specific CHANNEL (not just an individual video) to a Google Map using the map API? I can add a flickr feed using the following code: var kml = new ...
I am running a curl operation on the command line and am having trouble forcing the header to set as XML. I use the -H option to force the Content-Type to be xml, however, once I run the command I can ...
How can i get the direct link of flv from the specified url in javascript? I got a PHP script to do the same. This is only for youtube What it does is: do some pattern matching and create a new ...
I would like to know the size of the movie I am watching on any video site [ if not possible on all video sites, then at least on YouTube ]. So is it possible, say I will specify the complete path ...