Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 172
Registered: ‎01-17-2011
My Device: 9500 series
My Carrier: Airtel

How to generate Video Thumbnail

Hi All , 

How can i add video thumbnail from videos, these videos can be choosen from Playbook or by using camera.

I need to show the thumbnails of these videos.

I have tried several codes but me not getting any success.

 

protected function importVideo(event:MouseEvent):void
			{
				var file:File = File.userDirectory;
				file.addEventListener(Event.SELECT, mediaSelectHandler);
				file.browseForOpen("Select File To Import", [acceptableTypes]);
			}
			private function mediaSelectHandler(event:Event):void {
				vd = new VideoDisplay();
				vd.autoPlay = false;
				vd.horizontalCenter = 0;
				vd.verticalCenter = 0;
				vd.source = event.currentTarget.nativePath;
				this.stage.addChild(vd);
			}
			
			private function getSnapShot(event:MouseEvent):void{
				var bd:BitmapData = new BitmapData(200, 200);
				var matrix:Matrix = new Matrix();
				bd.draw(vd, matrix);
				
				//save to hard drive
				var file:File = File.documentsDirectory;
				var imgfile:File = file.resolvePath("SampleThumbe.jpg");
				var jpegEncoder:JPEGEncoder = new JPEGEncoder(90);
				var jpegStream:ByteArray = jpegEncoder.encode(bd);
				var filestream:FileStream = new FileStream();
				filestream.open(imgfile, FileMode.WRITE);
				filestream.writeBytes(jpegStream, 0, jpegStream.length);
				filestream.close();
			}

 ThanksIn Advance.

Retired
Posts: 427
Registered: ‎02-22-2012
My Device: BlackBerry Z10, BlackBerry Dev Alpha C, BlackBerry PlayBook
My Carrier: Bell

Re: How to generate Video Thumbnail

I found a decent looking article explaining this from doing a search here.

 

Where are you getting hung up?

 

Regards,
Dustin 

Follow me on Twitter: @dustinmalik
-----------------------------------------------------------------------------------------------------
Keep up to date on BlackBerry development: http://devblog.blackberry.com/
Highlighted
Developer
Posts: 172
Registered: ‎01-17-2011
My Device: 9500 series
My Carrier: Airtel

Re: How to generate Video Thumbnail

Hello Dmalik ,

This Example shows that how to get thumbnail image from Url link because it is attaching url to stream in video class object .

I want to get video thumbnail from my local device ,Ho can i do this.

I have tried many times , it is always return me white thumbnail image.

Thanks for your reply, Hope you can still help me.

Shashank