Skip to content

Commit

Permalink
Fix: space shortcut is invalid when the focus is outside the video view
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed Mar 11, 2024
1 parent 8c1a9ac commit 7a97cd5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion wiliwili/include/view/video_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class VideoView : public brls::Box {
// 3. 全屏时 osd 显示状态下按返回键隐藏 osd,隐藏后再按返回键退出全屏。(之前:返回键控制直接退出全屏)
void setTvControlMode(bool state);

bool getTvControlMode();
bool getTvControlMode() const;

/// 设置播放时间 (左下角: 00:00:00/00:00:00 中左侧的值)
void setStatusLabelLeft(const std::string& value);
Expand Down
6 changes: 6 additions & 0 deletions wiliwili/source/activity/player_base_activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ void BasePlayerActivity::setCommonData() {
return true;
});

// 暂停
this->registerAction("toggle", brls::ControllerButton::BUTTON_SPACE, [this](...) -> bool {
this->video->togglePlay();
return true;
}, true);

this->btnQR->getParent()->addGestureRecognizer(new brls::TapGestureRecognizer(this->btnQR->getParent()));

this->btnAgree->getParent()->addGestureRecognizer(new brls::TapGestureRecognizer(this->btnAgree->getParent()));
Expand Down
6 changes: 3 additions & 3 deletions wiliwili/source/view/mpv_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ void MPVCore::init() {
// mpvSetOptionString(mpv, "msg-level", "all=no");
if (MPVCore::TERMINAL) {
mpvSetOptionString(mpv, "terminal", "yes");
#ifdef _DEBUG
mpvSetOptionString(mpv, "msg-level", "all=v");
#endif
if ( brls::Logger::getLogLevel() >= brls::LogLevel::LOG_DEBUG ) {
mpvSetOptionString(mpv, "msg-level", "all=v");
}
}

if (mpvInitialize(mpv) < 0) {
Expand Down
3 changes: 2 additions & 1 deletion wiliwili/source/view/video_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ VideoView::VideoView() {

// 暂停
this->registerAction("toggle", brls::ControllerButton::BUTTON_SPACE, [this](...) -> bool {
CHECK_OSD(true);
this->togglePlay();
return true;
}, true);
Expand Down Expand Up @@ -1029,7 +1030,7 @@ void VideoView::setTvControlMode(bool state) {
_setTvControlMode(isTvControlMode && !isLiveMode);
}

bool VideoView::getTvControlMode() { return isTvControlMode; }
bool VideoView::getTvControlMode() const { return isTvControlMode; }

void VideoView::_setTvControlMode(bool state) {
btnToggle->setCustomNavigationRoute(brls::FocusDirection::RIGHT, state ? osdSlider : iconBox);
Expand Down

0 comments on commit 7a97cd5

Please sign in to comment.