Merge lp:~artem-anufrij/audience/Bugfix-1359688 into lp:~audience-members/audience/trunk

Proposed by Artem Anufrij
Status: Merged
Approved by: Cody Garver
Approved revision: 402
Merged at revision: 406
Proposed branch: lp:~artem-anufrij/audience/Bugfix-1359688
Merge into: lp:~audience-members/audience/trunk
Diff against target: 244 lines (+84/-32)
3 files modified
src/Audience.vala (+68/-25)
src/Widgets/Playlist.vala (+10/-2)
src/Widgets/VideoPlayer.vala (+6/-5)
To merge this branch: bzr merge lp:~artem-anufrij/audience/Bugfix-1359688
Reviewer Review Type Date Requested Status
Cody Garver Approve
Viko Adi Rahmawan (community) Approve
Fabio Zaramella (community) Approve
Artem Anufrij (community) Approve
Review via email: mp+235220@code.launchpad.net

Commit message

Reset last played videos and show welcome after playback ends

To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote :

Shows the welcome (with continued background audio) at the end of playback of each playlist item, instead of only the final playlist item

review: Needs Fixing
399. By artem-anufrij

The fixes have been corrected. Please, check it.

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

Please, check my fixes...

Thx

review: Approve
Revision history for this message
Fabio Zaramella (fabiozaramella) wrote :

it looks good to me

review: Approve
Revision history for this message
Cody Garver (codygarver) wrote :

I'm gonna merge this tomorrow with some minor cosmetic changes

On Sun, Sep 21, 2014 at 3:45 PM, Fabio Zaramella <email address hidden>
wrote:

> Review: Approve
>
> it looks good to me
> --
>
> https://code.launchpad.net/~artem-anufrij/audience/Bugfix-1359688/+merge/235220
> You are reviewing the proposed merge of
> lp:~artem-anufrij/audience/Bugfix-1359688 into lp:audience.
>

--
Cody Garver

Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

I think we want a "Replay playlist" in the newly made welcome screen is it?
And video doesnt get resumed after closing and reopening audience.

review: Needs Fixing
Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

Ah, i just see that the Bug #1363391 and resuming video imediately is a design decission (which is debatable by the way) so changing this behaviour need UX brainstorming. And current resuming behaviour is respecting resume-videos key in gsettings, so if its to be changed you only need to change default value for resume-videos key.
thanks

400. By artem-anufrij

Replay button on welcome screen at the end of playback.

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

> I think we want a "Replay playlist" in the newly made welcome screen is it?
> And video doesnt get resumed after closing and reopening audience.

Here is a example for a replay button on welcome screen.

What do you think?

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :
Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

* put replay button as number two button, under the open file button so that it looks like changing resume button
* use last video title as replay button description text just like resume button
* dont clear video setting, instead call playlist.save_playlist_config (); set playlist first video as setting.current_video and set setting.last_stopped to 0.0 so that if you close audience resume video will pickup your playlist
* as i type in previous comment, dont remove the ability to resume video on audience opening

I cant reproduce Bug #1360667 so have nothing to say about it.

review: Needs Fixing
401. By artem-anufrij

replay button was put as number two button; video setting won't be cleaned; ability to resume video on audience opening

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

> * put replay button as number two button, under the open file button so that
> it looks like changing resume button

OK

> * use last video title as replay button description text just like resume
> button

Where can I do that after append the Button?

> * dont clear video setting, instead call playlist.save_playlist_config (); set
> playlist first video as setting.current_video and set setting.last_stopped to
> 0.0 so that if you close audience resume video will pickup your playlist

OK

> * as i type in previous comment, dont remove the ability to resume video on
> audience opening

OK

Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

Yeah, i think we can't change it, just ignore my comment

try this one:
- play video till it show the welcome screen
- close audience
- open audience, there is resume video, close audience
- open audience, but now there isnt resume video entries.

review: Needs Fixing
Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

> Yeah, i think we can't change it, just ignore my comment
>
> try this one:
> - play video till it show the welcome screen
> - close audience
> - open audience, there is resume video, close audience
> - open audience, but now there isnt resume video entries.

And if I would like to see again and again the same video to be played at the start?

I think automaticly resume is not a good feature. A resume button in the welcome screen is nice. Because if i start audience i don't wont automaticly play the last video, but with the resume button in the welcome screen i have the option to do that.

Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

I dont think you understand my last comment. Im fine with the welcome screen but not with clear_video_setting.

I mean the problem is with clear_video_settings(); in on_destroy ().
remove those clear_video_settings () and my complain about there is no resume video entries will be fixed.

Thanks

review: Needs Fixing
Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

> I mean the problem is with clear_video_settings(); in on_destroy ().
> remove those clear_video_settings () and my complain about there is no resume
> video entries will be fixed.

Current clear_video_setting () will be called after a DVD was playing and not everytime. I'll create a flowchart.

Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

Follow my steps above, setting will get cleared.

review: Needs Fixing
Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

> Follow my steps above, setting will get cleared.

Yes! I think I have understood what you mean.

Please check my flowchart:
https://bugs.launchpad.net/audience/+bug/1359688/+attachment/4215892/+files/Audience.jpg

Is it correct?

Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

As I dont have DVD i'll let you decide whether we need DVD checking in bottom left. You dont need to remove it if you think thats necessary.
The problem with current code is when on_destroy being called from welcomescreen in topleft, clear_setting got called which is unecessary

i think this one should work CMIIW

        private void on_destroy () {
            if ( video_player.uri.has_prefix ("dvd://")) {
                clear_video_settings();
                return;
            }

            if (video_player.uri == null || video_player.uri == "" )
                return;

            save_last_played_videos ();
        }

And dont forget about inline comment i type before about some little code format changes.
Thanks Artem.

review: Needs Fixing
Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

Sorry I meant

As I dont have DVD i'll let you decide whether we need DVD checking in bottom *right

review: Needs Fixing
402. By artem-anufrij

Implemented as agreed (flowchart).

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

Hey guys, please check my changes.

Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

Great work Artem,
As I can't reproduce Bug #1360667 I'll just give it a go.
Thanks

review: Approve
Revision history for this message
Cody Garver (codygarver) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Audience.vala'
2--- src/Audience.vala 2014-09-03 00:07:10 +0000
3+++ src/Audience.vala 2014-09-26 20:46:20 +0000
4@@ -198,7 +198,12 @@
5 //end
6 video_player.ended.connect (() => {
7 Idle.add (() => {
8- playlist.next ();
9+ if (!playlist.next ()) {
10+ welcome.set_item_visible (1, false);
11+ welcome.set_item_visible (2, true);
12+ welcome.show_all ();
13+ clutter.hide ();
14+ }
15 return false;
16 });
17 });
18@@ -328,25 +333,30 @@
19 }
20
21 welcome.set_item_visible (1, show_last_file);
22-
23+
24+ welcome.append ("media-playlist-repeat", _("Replay"), _("Replay last video, or playlist"));
25+ welcome.set_item_visible (2, false);
26+
27 welcome.append ("media-cdrom", _("Play from Disc"), _("Watch a DVD or open a file from disc"));
28- welcome.set_item_visible (2, false);
29+ welcome.set_item_visible (3, false);
30
31 //look for dvd
32 var disk_manager = DiskManager.get_default ();
33 foreach (var volume in disk_manager.get_volumes ()) {
34- welcome.set_item_visible (2, true);
35+ welcome.set_item_visible (3, true);
36 }
37
38 disk_manager.volume_found.connect ((vol) => {
39- welcome.set_item_visible (2, true);
40+ welcome.set_item_visible (3, true);
41 });
42
43 disk_manager.volume_removed.connect ((vol) => {
44 if (disk_manager.get_volumes ().length () <= 0)
45- welcome.set_item_visible (2, false);
46+ welcome.set_item_visible (3, false);
47 });
48
49+
50+
51 //handle welcome
52 welcome.activated.connect ((index) => {
53 switch (index) {
54@@ -361,8 +371,16 @@
55 video_player.playing = false;
56 Idle.add (() => {video_player.progress = settings.last_stopped; return false;});
57 video_player.playing = true;
58+ break;
59+ case 2:
60+ welcome.hide ();
61+ clutter.show_all ();
62+ open_file (playlist.get_first_item ().get_path ());
63+ video_player.playing = false;
64+ Idle.add (() => {video_player.progress = 0; return false;});
65+ video_player.playing = true;
66 break;
67- case 2:
68+ case 3:
69 run_open_dvd ();
70 break;
71 default:
72@@ -522,11 +540,15 @@
73 }
74
75 private void on_destroy () {
76- if (video_player.uri == null || video_player.uri == "" || video_player.uri.has_prefix ("dvd://"))
77+ if (video_player.uri.has_prefix ("dvd://")) {
78+ clear_video_settings ();
79 return;
80- if (!video_player.at_end) {
81- save_last_played_videos ();
82 }
83+
84+ if (video_player.uri == null || video_player.uri == "")
85+ return;
86+
87+ save_last_played_videos ();
88 }
89
90 private int old_h = - 1;
91@@ -563,11 +585,22 @@
92 private inline void save_last_played_videos () {
93 playlist.save_playlist_config ();
94
95- if (settings.current_video != "")
96+ debug ("saving settings for: %s", playlist.get_first_item ().get_uri ());
97+
98+ if (settings.current_video != "" && !video_player.at_end)
99 settings.last_stopped = video_player.progress;
100- else
101+ else if (settings.current_video != "" && video_player.at_end) {
102+ settings.current_video = playlist.get_first_item ().get_uri ();
103 settings.last_stopped = 0;
104- }
105+ }
106+ }
107+
108+ private inline void clear_video_settings () {
109+ settings.last_stopped = 0;
110+ settings.last_played_videos = null;
111+ settings.current_video = "";
112+ }
113+
114
115 private void restore_playlist () {
116 foreach (var filename in settings.last_played_videos) {
117@@ -593,13 +626,20 @@
118
119 file.set_current_folder (settings.last_folder);
120 if (file.run () == Gtk.ResponseType.ACCEPT) {
121- welcome.hide ();
122- clutter.show_all ();
123-
124- playlist.add_item (file.get_file ());
125- if (video_player.uri == null)
126+ if (welcome.is_visible ()) {
127+ playlist.clear_items ();
128+ }
129+
130+ foreach (File item in file.get_files ()) {
131+ playlist.add_item (item);
132+ }
133+
134+ if (video_player.uri == null || welcome.is_visible ())
135 open_file (file.get_uri ());
136-
137+
138+ welcome.hide ();
139+ clutter.show_all ();
140+
141 settings.last_folder = file.get_current_folder ();
142 }
143
144@@ -724,13 +764,16 @@
145 && settings.last_played_videos.length > 0
146 && settings.current_video != ""
147 && file_exists (settings.current_video)) {
148- welcome.hide ();
149- clutter.show_all ();
150 restore_playlist ();
151- open_file (settings.current_video);
152- video_player.playing = false;
153- Idle.add (() => {video_player.progress = settings.last_stopped; return false;});
154- video_player.playing = true;
155+
156+ if (settings.last_stopped > 0) {
157+ welcome.hide ();
158+ clutter.show_all ();
159+ open_file (settings.current_video);
160+ video_player.playing = false;
161+ Idle.add (() => {video_player.progress = settings.last_stopped; return false;});
162+ video_player.playing = true;
163+ }
164 }
165 }
166
167
168=== modified file 'src/Widgets/Playlist.vala'
169--- src/Widgets/Playlist.vala 2014-08-09 01:13:20 +0000
170+++ src/Widgets/Playlist.vala 2014-09-26 20:46:20 +0000
171@@ -67,14 +67,17 @@
172 });
173 }
174
175- public void next () {
176+ public bool next () {
177 Gtk.TreeIter iter;
178 if (playlist.get_iter_from_string (out iter, (this.current + 1).to_string ())){
179 string filename;
180 playlist.get (iter, Columns.FILENAME, out filename);
181 current++;
182 play (File.new_for_commandline_arg (filename));
183+ return true;
184 }
185+ current = 0;
186+ return false;
187 }
188
189 public void previous () {
190@@ -131,6 +134,11 @@
191 return false;
192 });
193 }
194+
195+ public void clear_items () {
196+ current = 0;
197+ playlist.clear ();
198+ }
199
200 public File? get_first_item () {
201 Gtk.TreeIter iter;
202@@ -165,7 +173,7 @@
203 playlist.set (new_iter, Columns.PLAYING, new ThemedIcon ("media-playback-start-symbolic"));
204
205 this.current = current_played;
206-
207+
208 }
209
210 public List<string> get_all_items () {
211
212=== modified file 'src/Widgets/VideoPlayer.vala'
213--- src/Widgets/VideoPlayer.vala 2014-09-01 10:41:18 +0000
214+++ src/Widgets/VideoPlayer.vala 2014-09-26 20:46:20 +0000
215@@ -199,8 +199,10 @@
216 });
217
218 playbin.about_to_finish.connect (() => {
219- at_end = true;
220- ended ();
221+ if (!at_end) {
222+ at_end = true;
223+ ended ();
224+ }
225 });
226
227 playbin.text_tags_changed.connect ((el) => {
228@@ -442,8 +444,7 @@
229 }
230 }
231
232- public void seek_jump_seconds (int seconds)
233- {
234+ public void seek_jump_seconds (int seconds) {
235 int64 position;
236 playbin.query_position (Gst.Format.TIME, out position);
237
238@@ -458,4 +459,4 @@
239 playbin.seek_simple (Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE, new_position);
240 }
241 }
242-}
243+}
244\ No newline at end of file

Subscribers

People subscribed via source and target branches