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?
Related
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.
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
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.
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!
I am trying to develop a wireless phone projector, wherein I will be showing phone screen on projector using a projector connected PC.
I am bit confused on how to capture screenshot of any running application in j2me.
Can you help?
Just want to capture screenshot in j2me
I'm not really sure of what you wanted to do but if you are thinking of a way for your app to get a screenshot of its screen then what I can say is that you can and cannot do it. Why you cannot do it? Say your using a canvas in creating your screen. I think there isn't a way of converting the Canvas to an Image. The Canvas is limited to just drawing itself on the phone screen. But, like what I have said earlier, you can also create a screenshot of your app screen. What you need to have is an Image object over your Canvas. Why Image? It is because the Image object can be converted to an image file. And the image file will be your screenshot. But, of course, there should be something that dynamically creates the image source for the image object on the canvas.
Image myScreen = Image.createImage(createScreen());
A method that creates the screen:
InputStream createScreen(){
//dynamically creates the source of the screen
}
You can have a screenshot using myScreen. The drawback here is that rendering is quite slow. This is possible but I think this is kind of difficult to implement.
With this snippet code you can take a "screenshot" of the Canvases in your app:
public Image getScreenShot() {
Image screenshot = Image.createImage(getWidth(), getHeight());
Graphics g = screenshot.getGraphics();
paint(g);
return Image.createImage(screenshot);
}
Add getScreenShot() to any canvas that you want "screenshot" of it.Then you can get it's RGB and convert to byte[] and pass it on the network.
References:
developer.nokia