StageVideo on iOS resize on orientation change issue


i using simplestagevideo library thibault (http://www.bytearray.org/?p=2571) in ios app, using starling graphics , switching stagevideo player videos. here behavior seeing:

the video opens portrait mode, every time

when video opens in portrait, video viewport centered correctly , video stretches fill screen correct aspect ratio

when turn landscape mode, video rotates not scale properly. shows in correct x , y position, not large enough fill out screen.

 

this strange behavior because simplestagevideo class handles these resizes far can tell. on orientation change listening to, new stage dimensions , send simplestagevideo object resize command. resize command sees correct screen size, sets stagevideo.viewport property correctly (as trace statements show) video still not right size. i'm not sure how fix because size-related property can set on stagevideo objects viewport isn't doing me. videowidth , videoheight read-only. has seen issue this?

 

i have attached screen shots, clear on issue is. according trace statements, viewport in portrait rectangle(0, 300, 640, 360) correct, , in landscape rectangle(0, 50, 960, 540) correct.

 

thanks time!

nick

img_1654.pngimg_1655.png

here relevant code project:

 

protected function onorientationchange(event:stageorientationevent):void {

if (_ssv) {

                if (stage.deviceorientation == stageorientation.default || stage.deviceorientation == stageorientation.upside_down) {

                    trace("portrait!");

                } else {

                    trace("landscape!");

                }

               

                // if not iphone, use stagewidth & stageheight

                if (_device.indexof("unknown") != -1) {

                    _ssv.resize(stage.stagewidth, stage.stageheight);

                } else {

                    _ssv.resize(stage.fullscreenwidth, stage.fullscreenheight);

                }

            }

        }

 

public function resize (width:uint=0, height:uint=0):void

        {   

            try {

                _width = width, _height = height;

               

                if ( _stagevideoinuse )    {

                    _sv.viewport = getvideorect(_sv.videowidth, _sv.videoheight);

                    trace("                                                                   final viewport:", _sv.viewport);

                } else {

                    _rc = getvideorect(_video.videowidth, _video.videoheight);

                    _video.width = _rc.width;

                    _video.height = _rc.height;

                    _video.x = _rc.x, _video.y = _rc.y;

                }

            } catch (e:error) {

                //trace("failed resize simplestagevideo");

            }

        }

 

private function getvideorect(width:uint, height:uint):rectangle

        {   

            var videowidth:uint = width;

            var videoheight:uint = height;

            var scaling:number = math.min ( _width / videowidth, _height / videoheight );

            videowidth *= scaling, videoheight *= scaling;

           

            var posx:number = stage.fullscreenwidth - videowidth >> 1;

            var posy:number = stage.fullscreenheight - videoheight >> 1;

           

            // check see if pc, swap

            if (devicedetector.getdevice().indexof("unknown") != -1) {

                posx = stage.stagewidth - videowidth >> 1;

                posy = stage.stageheight - videoheight >> 1;

            }

           

            _videorect.x = posx;

            _videorect.y = posy;

            _videorect.width = videowidth;

            _videorect.height = videoheight;

           

            return _videorect;

        }



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support