views:

73

answers:

2

I am trying to use BitmapData.draw() on a video object, but using the OSMF framework.

My hosting service has set up the following so that I can access my rtmp video:

<VideoSampleAccess enabled="true">/</VideoSampleAccess>  

Simplified code is as follows:

_videoURL = "my-url-here"       
resource = new StreamingURLResource(_videoURL);
videoElement = new VideoElement(resource);          
_player.media = videoElement; 
container.addMediaElement(videoElement);
_player.autoPlay = true;
_player.play();

// later on, pause the player at the end
_player.pause();
// get the Video object
videoObj = _player.displayObject as Video;
// detach the netstream
videoObj.attachNetStream(null);

// get the bitmap from the Video object and draw on it..
bmpdata:BitmapData = new BitmapData(videoObj);

 bmpdata.draw()

However, I am getting the following error message:

SecurityError: Error #2135: Security sandbox violation: BitmapData.draw: ...
A: 

You could try drawing the container instead of the video object itself. The source for the draw method can be either of type Bitmap or DisplayObject , so any MovieClip or Sprite that adds your video should be drawable.

Edit: You're right, wasn't really thinking ,if there's a security issue, drawing the container won't change much...

You could try this:

import flash.system.Security;

Security.loadPolicyFile('policyfileURL');
PatrickS
Hm, I think that helps, but I am still getting a security Error. Is there any way to set checkPolicyFile = true using OSMF?
redconservatory
please check the edited answer
PatrickS