【问题标题】:Fullscreen Video Pushing the NavBar upwards to the size of the status bar and remains there after exit Fullscreen全屏视频将导航栏向上推到状态栏的大小并在退出全屏后保持在那里
【发布时间】:2015-10-28 12:19:59
【问题描述】:

问题是当用户切换到全屏视频然后返回时,NavigationWindow 的 NavBar 被向上推到状态栏的大小并保持在那里。

对我来说唯一可行的解​​决方案是关闭并重新打开 MainNavigationWindow。这不可能是最终的解决方案。

更多提示来自我: 视频视图的 z-index 高于其他视图。 全屏显示应用程序并在 tiapp.xml 中禁用隐藏导航栏和状态栏。 MainNavigationWindow 的全屏,它的主窗口在 .tss 文件。

看起来这将被全部忽略。 来自 VideoPlayer 的全屏信号被触发并将导航栏向上推到状态栏的大小。 全屏退出后,导航栏保持在该位置。 并且在导航栏下方,StatusBar 的大小仍然存在黑色间隙。

截图>> here <<

5 个月前在 Appcelerator 网站上问过同样的问题 >> here <<。 (无解)


主窗口

<Alloy>
<NavigationWindow id="mainNavigationWindow" platform="ios">
<Window id="mainWindow" class="container">
<Require src="webview" id="startWindowWebViewView"/>
<Require src="videoPlayer" id="startWindowVideoPlayerView"/>
<Require src="menu" id="startWindowMenuView"/>
</Window>
</NavigationWindow>
</Alloy>

查看

<Alloy>
<View id="videoPlayerContainer" class="container">
<VideoPlayer id="videoPlayerContainerVideoPlayer" />
</View>
</Alloy>

TSS

"#videoPlayerContainerVideoPlayer":{
    height:Titanium.UI.FILL,
    width:Titanium.UI.FILL,
    borderWidth: 1,
    zIndex: 1,
    visible: false,
    mediaControlStyle: Titanium.Media.VIDEO_CONTROL_EMBEDDED,
    scalingMode: Titanium.Media.VIDEO_SCALING_ASPECT_FIT,
    autoplay: false
}

控制器

function hideVideoPlayer() {
$.videoPlayerContainer.setVisible(false);
$.videoPlayerContainerVideoPlayer.setSourceType(Titanium.Media.VIDEO_SOURCE_TYPE_UNKNOWN);
}

function setVideoPlayerMedia(media) {
$.videoPlayerContainerVideoPlayer.setSourceType(Titanium.Media.VIDEO_SOURCE_TYPE_UNKNOWN);
$.videoPlayerContainerVideoPlayer.setSourceType(Titanium.Media.VIDEO_SOURCE_TYPE_FILE);
$.videoPlayerContainer.setVisible(true);
$.videoPlayerContainerVideoPlayer.setMedia(media);

}

【问题讨论】:

  • 这也发生在我身上,但没有视频。我有一个带导航栏的窗口。然后打开一个全屏窗口。关闭此窗口,上一个窗口会将导航栏缩小到状态。这仅适用于 iOS,我使用的是 SDK 3.5.1.GA
  • 感谢您的评论!我将为此创建一张 Jira 票证。同时,我开发了两种解决方法来解决或绕过此错误。

标签: ios titanium appcelerator titanium-alloy


【解决方案1】:

同时,我已经开发了两种解决方法来解决或绕过此错误。

第一个(在应用中永久隐藏状态栏。)

tiapp.xml(添加键:UIStatusBarHidden 值:true)

<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
    <ios>
        <plist>
            <dict>
                <key>UIStatusBarHidden</key>
                <true/>
            </dict>
        </plist>
    </ios>
</ti:app>

第二个(离开全屏时重新加载 NavigationWindow) 快速示例:

videoPlayer.addEventListener('fullscreen', function(e) {

    if (e.entering == 0) {
        Ti.API.info("Get out of fullscreen");

        playbackTime = videoPlayer.getCurrentPlaybackTime();
        playing = videoPlayer.getPlaying();

        // Fixes The MenuBar Gap
        Alloy.Globals.mainNavigationWindow.close();
        Alloy.Globals.mainNavigationWindow.open();

        // Wait until Video is ready
        while (videoPlayer.getLoadState() != 3) {}

        // set initial Start time to last play time
        videoPlayer.setCurrentPlaybackTime(playbackTime);

        // checks if the Video was playing
        if (playing) {
            Ti.API.info("start playing again");
            videoPlayer.play();
        }
    } else {
        Ti.API.info("Get in fullscreen");
    }
});

【讨论】:

    【解决方案2】:

    这看起来像是一个有效的错误。请check 如果这是您可以观看的已知问题,或者create 带有可重现的步骤/环境/代码的票证,以便我们可以重现和修复它。

    【讨论】:

    • 感谢您的回复!我将创建一个 Jira 票证,因为我没有找到合适的开放票证。
    【解决方案3】:

    对于那些仍在寻找像我这样的解决方案的人,另一种解决方案是通过本地 HTML5 播放器流式传输您的视频并使用网络视图打开它,这是我找到的解决此问题的最佳解决方案,直到它得到修复。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-09
      • 1970-01-01
      • 2011-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-25
      相关资源
      最近更新 更多