Rotating the MoviePlayer automatically created by YouTube link - xamarin.ios

I'm playing YouTube videos in my app - the app is Portrait only except that I'd like to have the videos play Landscape. I'm using the much publicized WebView method:
public YouTubeViewer(string url, RectangleF frame)
{
string youTubeVideoHTML = #"<object width=""{1}"" height=""{2}""><param name=""movie""
value=""{0}""></param><embed
src=""{0}"" type=""application/x-shockwave-flash""
width=""{1}"" height=""{2}""</embed></object>";
string html = string.Format(youTubeVideoHTML, url, frame.Size.Width, frame.Size.Height);
this.LoadHtmlString(html, null);
this.Frame = frame;
}
This works great except that the MoviePlayer is in Portrait orientation only. I've tried calling the WebView from within a new ViewController that supports ALL orientations, but it has no effect. I've tried rotating the WebView, but that does not affect the MoviePlayer that is magically called by the iOS.
Any help would be much appreciated.
Thanks,
Rick

The app info.plist was set to only allow Portrait orientation. Changed that and the YouTube controller correctly rotates the MoviePlayer!

Related

How to capture iPhone screen with animating UIWebview?

I've just created code for screen video capturing..its perfectly working using UIView.but if i use UIWebview than the capture screen video is displayed with stuck..I know the reason.the reason is while using web view
[[self.layer presentationLayer] renderInContext:mycontext];
is not working..and my app is crashed
so,if presentation layer is not working than video will be stuck.
and using this line
[self.layer renderInContext:mycontext];
the screen captureing is working,but video is displaying with stuck.
this is the code,while user browse any web-site in his or her mobile.
UIGraphicsBeginImageContextWithOptions(self.bounds.size, YES, 0.0);
CGContextRef mycontext = UIGraphicsGetCurrentContext();
if([[self.layer presentationLayer] respondsToSelector:#selector(renderInContext:)])
{
[[self.layer presentationLayer] renderInContext:mycontext];
}
else
{
[self.layer renderInContext:mycontext];
}
UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
while scrolling the webview and captured the video,than the capture screen video is displayed with stuck..
is there any solution?

How to play YouTube video in WebView on Google Glass

I have code like this:
setContentView(R.layout.webview);
webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("https://www.youtube.com/watch?v=_Z5-P9v3F8w");
It'll show the youtube video with the Play button, but none of the Glass gesture can make the video play. Any ideas? Thanks!
Finally figured out how to play Youtube video on Glass!
Intent i = new Intent();
i.setAction("com.google.glass.action.VIDEOPLAYER");
i.putExtra("video_url", "https://m.youtube.com/watch?v=5bWSgFnoCOk");
startActivity(i);
Using WebView can't play the video, using VideoView can only play local MP4 or streaming MP4 (there's some way to hack the MP4 link for a Youtube video, but not reliable). Also, using VideoView can only pause/play the video, but not fast forward or backward. Using the com.google.glass.action.VIDEOPLAYER above solves all the problems WebView and VideoView have.

Using a Webview in a splitview controller

I'm having trouble displaying content properly in a splitview application. In the detail view I have a webview and I'm loading locally saved html files. However the files don't display properly - they are slightly zoomed in and missing detail on the left and right. Double taping them zooms them out and they display correctly. I have scaletofitpages=YES set.
Any advice?
Well, if i'm understanding you correctly, you can use auto layout.. it will fit your content from left and right.
to set the font size you must edit your html content add "css style" to them...
// Get result into string format
NSString *htmlData = [objSQLiteProtocol getDatabaseResults:fileNameToRead];
// reduce the size of font to set in iPad
htmlData = [htmlData stringByReplacingOccurrencesOfString:#"25pt" withString:#"12pt"];
[moreWebView loadHTMLString:htmlData baseURL:nil];
moreWebView.scalesPageToFit = YES;

Video Recording in j2me

I am doing task in j2me which record the video and save in memory card and displaying it in the canvas. The problem is I want to take snap shoot for displaying the video properly, to be clear for a thumbnail, I used the code
public Image getScreenShot() {
screenshot = Image.createImage(getWidth(),
getHeight());
Graphics g = screenshot.getGraphics();
paint(g);
return screenshot;
}
It gives a null pointer exception. Now my problem is, Is it possible to get a thumbnail for a video in j2me, Anybody suggest some other ways for it??
Assuming you are using VideoControl class from javax.microedition.media.control.VideoControlyou can save of of the frames while processing it (before you display it on the screen) with:
byte[] raw = videoControl.getSnapshot(null);
Image image = Image.createImage(raw, 0, raw.length);
Before displaying the image on the form with
form.append(image);
display.setCurrent(form);
Just save it to the storage.
Full source code for running a video (captured tho) can be found here and using VideoControl to play recorded videos here

Black preview screen working with Expression.Encoder and webcam

I wrote some C# code interface with a Logitech webcam using Expression.Encoder. The code was pretty easy to set it and works beautifully on my machine and my tester's machine. Unfortunately out in the field the preview screen for the camera shows a black screen. I've confirmed the camera displays a feed in both Logitech's app and also MS's Expression application. Windows Media Player and DirectX 11 are installed. The problem seems to be in the preview window creation that someone is not working.
// create the camera feed with just a video
currentJob = new LiveJob();
currentDeviceSource = currentJob.AddDeviceSource(currentVideoDevice, null);
System.Drawing.Size size = new System.Drawing.Size(250, 275);
currentDeviceSource.PickBestVideoFormat(size, (long)15);
SourceProperties sp = currentDeviceSource.SourcePropertiesSnapshot();
pnlCameraPreview.Size = new System.Drawing.Size(sp.Size.Width, sp.Size.Height);
currentJob.OutputFormat.VideoProfile.Size = new System.Drawing.Size(sp.Size.Width, sp.Size.Height);
// attach to the preview panel
currentDeviceSource.PreviewWindow = new PreviewWindow(new HandleRef(pnlCameraPreview, hwndPreviewPanel));
currentJob.ActivateSource(currentDeviceSource);
The Panel in question (pnlCameraPreview) is a windows forms panel hosting inside of wpf. Any thoughts on why this isn't working would be appreciated!
We use the approach in production. It works all the time but the problem in question can be reproduced on a fresh box when no native video card drivers are installed. Perhaps the root of the problem is with painting video over the panel. BTW while the problem with the code similar to the posted one is observed Skype and Encoder's preview displays webcam pics all right.
Preview panel starts show pics and the code starts to work properly after all the adapters's drivers are installed.

Resources