video works ok in IOS simulator but not on iPad

Software: Away3D 4.x

hfeist, Jr. Member
Posted: 15 March 2014 10:21 PM   Total Posts: 37

Using the code below i can get video to play within the IOS simulator within FlashBuilder but not on the iPad itself.

Any ideas?

//video texture
   
var vt:VideoTexture = new VideoTexture("PicassoPtgOnGlass8fps_1_1.flv"256256true,true);
   var 
tm:TextureMaterial = new TextureMaterial(vttrue);
   var 
planeGeom:PlaneGeometry = new PlaneGeometry(102473011falsetrue);
   
planeMesh = new Mesh(planeGeomtm);
   
scene.addChild(planeMesh);
   
planeMesh.y=365;
   
videoMaterial = new TextureMaterial(videoBitmapTexture = new BitmapTexture(new BitmapData(512512true0xFFFF0000)), falsetrue); 
   

Avatar
mrpinc, Sr. Member
Posted: 16 March 2014 01:27 AM   Total Posts: 119   [ # 1 ]

I am not sure you will be able to do that on iOS with just AIR.  In order to play video reasonably in AIR you must use StageVideo and there is no way to capture the bitmapData of a StageVideo object.  You could probably create a native extension to do it.  Here are a couple of links on the subjects:

http://stackoverflow.com/questions/10071706/flash-air-stage-video-on-ios-is-it-possible-how-is-the-performance

http://stackoverflow.com/questions/14512956/capturing-bitmapdata-from-a-video-display-playing-a-h-264-mp4-video

   

Avatar
theMightyAtom, Sr. Member
Posted: 16 March 2014 09:52 AM   Total Posts: 669   [ # 2 ]

Is the video streaming over the net when on iPad? You get a security violation if you try to capture from a video that’s not in the same domain.

Good Luck!

   

hfeist, Jr. Member
Posted: 17 March 2014 02:30 AM   Total Posts: 37   [ # 3 ]

No it isn’t streaming—it’s an flv.
I should mention that elsewhere in the project I have flv’s playing just fine on the iPad. I have even succeeded in getting video from the camera to play this way.
What I’m trying to do is get it to work also as a videotexture on a plane in away3d. As I mentioned it plays okay on a plane while in development in FlashBuilder’s IOS simulator. But when it’s compiled as .ipa and on the iPad itself it fails to appear.

   

Avatar
theMightyAtom, Sr. Member
Posted: 17 March 2014 07:40 AM   Total Posts: 669   [ # 4 ]

Can you display the video on the stage?

If so you can always bypass the VideoTexture (not sure how that works internally) and use an ordinary BitmapTexture, and use that’s BitmapData to capture the video. Worth a try!

Cheers

   

hfeist, Jr. Member
Posted: 18 March 2014 05:56 PM   Total Posts: 37   [ # 5 ]

Well I gave that a try as well but alas with the same result. The new code below works great but not on the iPad. I can sense that there’s something happening on the plane because whenever the camera is looking at it things get a bit sluggish then improve when it looks away.

private function playVideo():void{
 
 
var container:ObjectContainer3D = new ObjectContainer3D();
 
view.scene.addChild(container);
 
 var 
planeGeom:PlaneGeometry = new PlaneGeometry(64048011falsetrue);
 var 
planeMesh:Mesh = new Mesh(planeGeom);
 
container.addChild(planeMesh);
 
 var 
material:TextureMaterial = new TextureMaterial(bitmapTexture = new BitmapTexture(new BitmapData(512512true0xFFFF0000)), falsetrue);
 
planeMesh.material material;
 
planeMesh.y=240;
 
 
simpleVideoPlayer = new SimpleVideoPlayer();
 
simpleVideoPlayer.source "matisseCuttingUp8fps_1_1.flv";
 
simpleVideoPlayer.width 640;
 
simpleVideoPlayer.height 480;
 
simpleVideoPlayer.loop true;
 
simpleVideoPlayer.play();

 
addEventListener(Event.ENTER_FRAMEvideoEnterFrameHandler);
 
 function 
videoEnterFrameHandler(e:Event):void {

  
var bitmapData:BitmapData bitmapTexture.bitmapData;
  
bitmapData.lock();
  
bitmapData.fillRect(bitmapData.rect0);
  
bitmapData.draw(simpleVideoPlayer.container);
  
bitmapData.unlock();
  
bitmapTexture.invalidateContent();
  
  
view.render();
 
}
   

Beek, Member
Posted: 18 March 2014 11:53 PM   Total Posts: 67   [ # 6 ]

I read somewhere that FLVs are no good on iPad, and it’s better to use MP4s with h.264 encoding.

   

hfeist, Jr. Member
Posted: 19 March 2014 09:33 PM   Total Posts: 37   [ # 7 ]

I really got my hopes up with that suggestion. Sigh…

   

Beek, Member
Posted: 19 March 2014 11:47 PM   Total Posts: 67   [ # 8 ]

This is the post I was thinking of

http://swfhead.com/blog/?p=1617

. FLVs play terribly. F4Vs do NOT work. At all. Don’t bother. Use MP4. Encoding settings should be :

• H.264
• TV Standard: NTSC
• Profile/Level: Baseline 3.1 (Though I think High 3.1 looks better it also makes for larger file size.)
• Bitrate: CBR at 1.1

   

hfeist, Jr. Member
Posted: 20 March 2014 02:26 AM   Total Posts: 37   [ # 9 ]

Thanks for all the ideas and link. I believe that post is referring to getting video to play on the stage in iPad. I have good luck there but not in getting it to play on a plane in away3d 4. I gave it a try anyway but no luck—just a black plane.

   

hfeist, Jr. Member
Posted: 04 April 2014 01:54 AM   Total Posts: 37   [ # 10 ]

Well I finally have video playing on a plane in away3D on an iPad. The solution was to encode it as FLV, web 320x240, On2 VP6.

Simple as it appears, this code works fine:

var vt:VideoTexture = new VideoTexture("PicassoPtgOnGlass8fps.flv"512512true,true);
var 
tm:TextureMaterial = new TextureMaterial(vttrue);
tm.bothSides true;
var 
planeGeom:PlaneGeometry = new PlaneGeometry(64048011falsetrue);
planeMesh = new Mesh(planeGeomtm);
planeMesh.y=240;
scene.addChild(planeMesh); 
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X