Skip to content

Commit

Permalink
Add hint dialog when cannot access live stream
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed Nov 19, 2023
1 parent 57cff0a commit c5a5a81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion wiliwili/include/api/bilibili/result/home_live_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ class LivePlayUrlInfo {
public:
LivePlayUrl playurl;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(LivePlayUrlInfo, playurl);
inline void from_json(const nlohmann::json& nlohmann_json_j,
LivePlayUrlInfo& nlohmann_json_t) {
if (!nlohmann_json_j.at("playurl").is_null()) {
nlohmann_json_j.at("playurl").get_to(nlohmann_json_t.playurl);
}
}

class LiveRoomPlayInfo {
public:
Expand Down
5 changes: 4 additions & 1 deletion wiliwili/source/activity/live_player_activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,11 @@ void LiveActivity::onLiveData(const bilibili::LiveRoomPlayInfo& result) {
// 设置视频链接
brls::Logger::debug("Live stream url: {}", url);
this->video->setUrl(url);
break;
return;
}

this->video->showOSD(false);
showDialog("当前地区无法获取直播链接", "pictures/sorry.png", true);
}

void LiveActivity::onDanmakuInfo(int roomid,
Expand Down

0 comments on commit c5a5a81

Please sign in to comment.