简体   繁体   English

FLVPlayBack无法缩放到全屏

[英]FLVPlayBack not scaling to fullscreen

I'm trying to make an instance of FLVPlayBack run in fullscreen, without affecting the rest of the application. 我正在尝试使FLVPlayBack实例在全屏模式下运行,而不影响应用程序的其余部分。

According to stuff I've read, I have set the players scale mode so it will fit the window when its scaled up. 根据我读过的东西,我已经设置了播放器缩放模式,以便在缩放时适合窗口。

flvPlayer.scaleMode = "exactFit";

And in order to stop the stage from scaling up I've also set the stage's scale mode too. 为了阻止舞台扩大规模,我还设置了舞台的缩放模式。

stage.scaleMode = "noScale";

Then in order to try and control what the video player does when I click the fullscreen button, I also use the fullScreenTakeOver setting on the player. 然后,为了尝试控制单击全屏按钮时视频播放器的功能,我还使用了播放器上的fullScreenTakeOver设置。

If I set the code like to 'false' 如果我将代码设置为“ false”

flvPlayer.fullScreenTakeOver = false;

Then the whole interface becomes fullscreen, with the stage positioned in the centre of the window, I guess this is because I set the stage not to scale. 然后整个界面变为全屏,舞台位于窗口的中心,我想这是因为我将舞台设置为无法缩放。 The video stays its normal size and carries on doing what it was doing. 该视频保持其正常大小,并继续执行正在执行的操作。 Exiting fullscreen shrinks the stage back to normal. 退出全屏模式会将舞台缩小到正常水平。

If, on the other hand I set it to 'true' 另一方面,如果我将其设置为“ true”

flvPlayer.fullScreenTakeOver = true;

Then the video takes over the screen, but it doesn't scale up, instead it positions the video in the middle of the page, and the clickable areas of the controls move to where they would be if the video was full size, leaving my guessing where the buttons should be. 然后,视频占据了屏幕,但它没有按比例放大,而是将视频放置在页面中间,并且控件的可点击区域移动到了视频为全尺寸的位置,猜测按钮应该在哪里。

In both cases the video carries on running fine. 在两种情况下,视频都能正常运行。

Can anyone help me with the right combination of settings? 有人可以为我提供正确的设置组合吗? I want the application to stay its windowed size and the fly player to scale to fit fullscreen by itself. 我希望应用程序保持其窗口大小,而动态播放器可以缩放以适合全屏显示。

Thanks. 谢谢。

There is a property in flvplayback named fullScreenTakeOver which is set by true by default. flvplayback有一个名为fullScreenTakeOver的属性,默认情况下设置为true。 this will interfere with fullscreen really bad. 这会干扰全屏,真的不好。 if you want to apply fullscreen without changing logic of your stage you better set this as false after instantiation. 如果要在不更改阶段逻辑的情况下应用全屏显示,则最好在实例化后将其设置为false。 this will decrease your troubles a lot 这将大大减少您的麻烦

You'll want to set a few settings which some you've already done 您将要设置一些已经完成的设置

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align     = StageAlign.TOP_LEFT;
flvPlayer.fullScreenTakeOver = false;

Now when you enter full screen your application stuff will positioned top left. 现在,当您进入全屏模式时,您的应用程序内容将位于左上方。 You will want to make an event listener for full screen mode. 您将需要为全屏模式设置事件监听器。

stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler);

In that event is where you will handle resizing and moving the video (Also hiding other objects on the stage if need be) 在那种情况下,您将处理视频的大小调整和移动(如果需要,还可以在舞台上隐藏其他对象)

function fullScreenHandler(e:FullScreenEvent):void
{
    if (stage.displayState == StageDisplayState.NORMAL)
    {
        // Setup NORMAL Layout
        // resize and reposition the flvPlayer
    }
    else
    {
        // Setup FULL_SCREEN Layout
        // move the flvPlayer to x:0 and y:0
        // set the flvPlayer width and height to stage.stageWidth and stage.stageHeight
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM