diff --git a/include/variables.hpp b/include/variables.hpp
index 9b63ebd6..0272e551 100644
--- a/include/variables.hpp
+++ b/include/variables.hpp
@@ -10,6 +10,7 @@ extern bool var_flash_mode;
extern bool var_wifi_enabled;
extern bool var_high_resolution_mode;
extern bool var_history_enabled;
+extern int var_autoplay_level;
extern int var_network_framework;
extern int var_network_framework_changed;
extern bool var_show_fps;
diff --git a/include/youtube_parser/parser.hpp b/include/youtube_parser/parser.hpp
index 6aabc656..9eb54689 100644
--- a/include/youtube_parser/parser.hpp
+++ b/include/youtube_parser/parser.hpp
@@ -149,6 +149,7 @@ struct YouTubeVideoDetail {
for (auto suggestion : suggestions) if (suggestion.type == YouTubeSuccinctItem::VIDEO) return true;
return false;
}
+ bool has_next_video_in_playlist() const { return playlist.videos.size() && playlist.selected_index != (int) playlist.videos.size() - 1; }
YouTubeVideoSuccinct get_next_video() const {
if (playlist.videos.size() && playlist.selected_index != (int) playlist.videos.size() - 1) return playlist.videos[std::max(0, playlist.selected_index + 1)];
for (auto suggestion : suggestions) if (suggestion.type == YouTubeSuccinctItem::VIDEO) return suggestion.video;
diff --git a/romfs/gfx/msg/string_resources_en.txt b/romfs/gfx/msg/string_resources_en.txt
index 32609112..76ac5a7f 100644
--- a/romfs/gfx/msg/string_resources_en.txt
+++ b/romfs/gfx/msg/string_resources_en.txt
@@ -87,6 +87,8 @@
Full screen mode
Dark theme
Flash
+Autoplay
+Playlist only
Size of images in community posts
Linear video filter
Network framework
diff --git a/romfs/gfx/msg/string_resources_ja.txt b/romfs/gfx/msg/string_resources_ja.txt
index ae05e1e4..d80610bb 100644
--- a/romfs/gfx/msg/string_resources_ja.txt
+++ b/romfs/gfx/msg/string_resources_ja.txt
@@ -87,6 +87,8 @@
フルスクリーンモード
ダークモード
点滅
+自動再生
+リスト中でのみ
コミュニティ投稿の添付画像の大きさ
動画の線形フィルタ
通信フレームワーク
diff --git a/source/scenes/setting_menu.cpp b/source/scenes/setting_menu.cpp
index 84b9a3e7..59ab2d9b 100644
--- a/source/scenes/setting_menu.cpp
+++ b/source/scenes/setting_menu.cpp
@@ -140,7 +140,25 @@ void Sem_init(void) {
->set_on_release([] (const BarView &view) { misc_tasks_request(TASK_SAVE_SETTINGS); }),
(new EmptyView(0, 0, 320, 10))
}),
- // Tab #2 : Data
+ // Tab #2 : UI/Display
+ (new ScrollView(0, 0, 320, 0))
+ ->set_views({
+ // Autoplay
+ (new SelectorView(0, 0, 320, 35))
+ ->set_texts({
+ (std::function) []() { return LOCALIZED(OFF); },
+ (std::function) []() { return LOCALIZED(ONLY_IN_PLAYLIST); },
+ (std::function) []() { return LOCALIZED(ON); }
+ }, var_autoplay_level)
+ ->set_title([](const SelectorView &) { return LOCALIZED(AUTOPLAY); })
+ ->set_on_change([](const SelectorView &view) {
+ if (var_autoplay_level != view.selected_button) {
+ var_autoplay_level = view.selected_button;
+ misc_tasks_request(TASK_CHANGE_BRIGHTNESS);
+ }
+ }),
+ }),
+ // Tab #3 : Data
(new ScrollView(0, 0, 320, 0))
->set_views({
// History recording
@@ -221,7 +239,7 @@ void Sem_init(void) {
}),
(new EmptyView(0, 0, 320, 10))
}),
- // Tab #3 : Advanced
+ // Tab #4 : Advanced
(new ScrollView(0, 0, 320, 0))
->set_views({
// Eco mode
@@ -282,6 +300,7 @@ void Sem_init(void) {
}, 0)
->set_tab_texts({
(std::function) [] () { return LOCALIZED(SETTINGS_DISPLAY_UI); },
+ (std::function) [] () { return LOCALIZED(PLAYBACK); },
(std::function) [] () { return LOCALIZED(SETTINGS_DATA); },
(std::function) [] () { return LOCALIZED(SETTINGS_ADVANCED); }
});
diff --git a/source/scenes/video_player.cpp b/source/scenes/video_player.cpp
index db48720a..713a0b5d 100644
--- a/source/scenes/video_player.cpp
+++ b/source/scenes/video_player.cpp
@@ -1574,7 +1574,9 @@ static void decode_thread(void* arg) {
vid_pausing = true;
if (!eof_reached) { // the first time it reaches EOF
svcWaitSynchronization(small_resource_lock, std::numeric_limits::max());
- if (playing_video_info.has_next_video()) send_change_video_request_wo_lock(playing_video_info.get_next_video().url, true, false, false);
+ if ((var_autoplay_level == 2 && playing_video_info.has_next_video()) ||
+ (var_autoplay_level == 1 && playing_video_info.has_next_video_in_playlist()))
+ send_change_video_request_wo_lock(playing_video_info.get_next_video().url, true, false, false);
svcReleaseMutex(small_resource_lock);
}
eof_reached = true;
diff --git a/source/system/util/settings.cpp b/source/system/util/settings.cpp
index ae173ab3..f1fb240f 100644
--- a/source/system/util/settings.cpp
+++ b/source/system/util/settings.cpp
@@ -36,6 +36,7 @@ void load_settings() {
var_night_mode = load_int("dark_theme", 0);
var_flash_mode = load_int("dark_theme_flash", 0);
var_community_image_size = std::min(COMMUNITY_IMAGE_SIZE_MAX, std::max(COMMUNITY_IMAGE_SIZE_MIN, load_int("community_image_size", COMMUNITY_IMAGE_SIZE_DEFAULT)));
+ var_autoplay_level = std::min(2, std::max(0, load_int("autoplay_level", 2)));
var_network_framework = var_network_framework_changed = load_int("use_experimental_sslc", -1); // for back compability
if (var_network_framework < 0 || var_network_framework >= 3) var_network_framework = var_network_framework_changed = load_int("network_framework", -1);
if (var_network_framework < 0 || var_network_framework >= 3) var_network_framework = var_network_framework_changed = 2;
@@ -60,6 +61,7 @@ void save_settings() {
"" + std::to_string(var_night_mode) + "\n" +
"" + std::to_string(var_flash_mode) + "\n" +
"" + std::to_string(var_community_image_size) + "\n" +
+ "" + std::to_string(var_autoplay_level) + "\n" +
"" + std::to_string(var_network_framework_changed) + "\n" +
"" + std::to_string(var_history_enabled) + "\n" +
"" + std::to_string(var_video_show_debug_info) + "\n" +
diff --git a/source/variables.cpp b/source/variables.cpp
index 54ba0d4b..e7f639ce 100644
--- a/source/variables.cpp
+++ b/source/variables.cpp
@@ -10,6 +10,7 @@ bool var_flash_mode = false;
bool var_wifi_enabled = false;
bool var_high_resolution_mode = true;
bool var_history_enabled = true;
+int var_autoplay_level = 2; // 0 : never, 1 : only in a playlist, 2 : always
int var_network_framework = 1;
int var_network_framework_changed = 1;
bool var_show_fps = false;
diff --git a/source/youtube_parser/parser.hpp b/source/youtube_parser/parser.hpp
index 6aabc656..9eb54689 100644
--- a/source/youtube_parser/parser.hpp
+++ b/source/youtube_parser/parser.hpp
@@ -149,6 +149,7 @@ struct YouTubeVideoDetail {
for (auto suggestion : suggestions) if (suggestion.type == YouTubeSuccinctItem::VIDEO) return true;
return false;
}
+ bool has_next_video_in_playlist() const { return playlist.videos.size() && playlist.selected_index != (int) playlist.videos.size() - 1; }
YouTubeVideoSuccinct get_next_video() const {
if (playlist.videos.size() && playlist.selected_index != (int) playlist.videos.size() - 1) return playlist.videos[std::max(0, playlist.selected_index + 1)];
for (auto suggestion : suggestions) if (suggestion.type == YouTubeSuccinctItem::VIDEO) return suggestion.video;