Skip to content

Commit

Permalink
Fix crash when turning off full-screen
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed Nov 21, 2023
1 parent f32a30c commit 5a863ff
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion wiliwili/source/view/video_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1037,10 +1037,19 @@ void VideoView::setFullScreen(bool fs) {
brls::sync([ASYNC_TOKEN]() {
ASYNC_RELEASE
//todo: a better way to get videoView pointer
auto activityStack = Application::getActivitiesStack();

// 当最前方的 activity 内不包含 videoView 时,不执行关闭全屏
Activity* top = activityStack[activityStack.size() - 1];
if (!dynamic_cast<BasePlayerActivity*>(top)) {
// 判断最顶层是否为video
if (!dynamic_cast<VideoView*>(
top->getContentView()->getView("video")))
return;
}

// 同时点击全屏按钮和评论会导致评论弹出在 BasePlayerActivity 和 videoView 之间,
// 因此目前需要遍历全部的 activity 找到 BasePlayerActivity
auto activityStack = Application::getActivitiesStack();
if (activityStack.size() <= 2) {
brls::Application::popActivity();
return;
Expand Down

0 comments on commit 5a863ff

Please sign in to comment.