0

in normal screenshot like this: bitmapData.draw(video, new Matrix()); but how to get video object in osmf player? I've tried draw mediaPlayerSprite result in a blank image

var pictureData:BitmapData = new BitmapData(width, height); 
var x:DisplayObjectTrait = _mediaPlayer.media.getTrait(org.osmf.traits.MediaTraitType.DISPLAY_OBJECT) as DisplayObjectTrait; 
var y:Video = x.displayObject as Video; 
pictureData.draw(m_container, new Matrix());  
var byteArray:ByteArray = new JPEGEncoder(80).encode(pictureData);  
var file:FileReference = new FileReference();  
file.save(byteArray, "pic.jpeg");
  • `var pictureData:BitmapData = new BitmapData(width, height); var x:DisplayObjectTrait = m_mediaPlayer.media.getTrait(org.osmf.traits.MediaTraitType.DISPLAY_OBJECT) as DisplayObjectTrait; var y:Video = x.displayObject as Video;pictureData.draw(m_container, new Matrix()); var byteArray:ByteArray = new JPEGEncoder(80).encode(pictureData); var file:FileReference = new FileReference(); file.save(byteArray, "pic.jpeg");` – user3607923 Jul 19 '14 at 01:31

1 Answers1

0

To get the Bitmapdata from the video:

var videoDisplay:VideoDisplay = video.videoDisplay;
var videoObject:Video = videoDisplay.videoObject;
var bitmapData:BitmapData = new BitmapData(videoObject.videoWidth, videoObject.videoHeight, true, 0x000000);
  • thanks for answer. but i just wander how to get the video from osmf(as mediaPlayer, mediaContainer),could you give more code plz? thank you again:) – user3607923 Jul 09 '14 at 01:01
  • Could you edit your question with the relevant code you already have, I don't think I understand your problem. So if you could elaborate on that aswell, that will allow me to help you more. – Robin van den Bogaard Jul 09 '14 at 09:27
  • I've added comment with code. the way i get video object should be wrong, could you post the right way? – user3607923 Jul 19 '14 at 01:41