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
Related
I've stored a video to a BitmapImage and want the user to be able to replay it. However, when I run my program it treats my BitmapImage like it's empty when it's not. I've tried doing the same thing with a picture saved to a BitmapImage and any picture will appear and fill the screen like I tell it to, but videos just don't show up. Why is this?
You cant store a video in a bitmapimage. Videos should be stored in StorageFile.
Use in your dictionary:
<MediaElement x:Key="Video1" Source="ms-appx:///Assets/Videos/Video.mp4"/
and then on page:
<MediaElement Source="{StaticResource Video1}"/>
remember to start width AutoPlay="True".
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?
I trying to create media player in window form application us C#. I want to get thumbnails of video file in order to show them in the playing list, Can any body help me to figure out the code or refer me some links. i am really stuck at this point
I am using GPUImage, and would like to extract a few frames from the video feed [GPUImageVideoCamera] and save as images to review when a button is clicked.
What is the best way to do this?
This is how you can get the current frame from the filter you are using.
UIImage *currentVideoFrame = [filter imageFromCurrentlyProcessedOutput];
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