After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 735259 - Allow Downloading HTML5 Videos
Allow Downloading HTML5 Videos
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
3.12.x (obsolete)
Other Linux
: Normal enhancement
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-23 03:12 UTC by GP
Modified: 2014-08-27 14:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
popup-commands: add include guards (1.12 KB, patch)
2014-08-24 04:33 UTC, Michael Catanzaro
none Details | Review
Add context menu entries for media elements (6.37 KB, patch)
2014-08-24 04:33 UTC, Michael Catanzaro
none Details | Review
A different approach to add media actions to context menu (12.81 KB, patch)
2014-08-26 11:51 UTC, Carlos Garcia Campos
committed Details | Review

Description GP 2014-08-23 03:12:37 UTC
Here's a sample: http://www.w3.org/2010/05/video/mediaevents.html

This is the ultimate thing that forces me to keep Firefox. When right-clicking on a traditional HTML5 video (YouTube HTML5 videos have their own right-click menu), there should be an option to save it offline.
Comment 1 Michael Catanzaro 2014-08-24 04:33:24 UTC
Created attachment 284325 [details] [review]
popup-commands: add include guards

Also add useless G_BEGIN_DECLS and G_END_DECLS since it's pretty
standard to use these everywhere.
Comment 2 Michael Catanzaro 2014-08-24 04:33:27 UTC
Created attachment 284326 [details] [review]
Add context menu entries for media elements

This commit adds the following new context menu entries for video and
audio elements:

* Save Media As...
* Copy Media Address
* Play Media

These context menu entries intentionally mirror the entries we use for
images.

It would be nicer to use the labels "Save Video As...", "Save Audio
As..." etc. but I didn't spot an obivous way to determine the type of
media.
Comment 3 Carlos Garcia Campos 2014-08-25 08:14:47 UTC
Review of attachment 284325 [details] [review]:

G_BEGIN_DECLS and G_END_DECLS are not useless, it's true they are not needed in this case, because this is not a public header that can be included by a C++ file, so I would reword the commit message.

::: src/popup-commands.h
@@ +19,3 @@
 
+#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION)
+#error "Only <epiphany/epiphany.h> can be included directly."

I don't think we need this at all, this is not a public header.
Comment 4 Michael Catanzaro 2014-08-25 15:03:09 UTC
But we don't have any public headers, so that boilerplate isn't needed anywhere. I guess this is a remnant from when we used to have extensions?  Are we purposefully keeping a distinction between headers that might in the future be public if we were to have extensions again?  I notice the makefiles have separate sections for installed and uninstalled headers (none of which get installed) which I was thinking about cleaning up....
Comment 5 Carlos Garcia Campos 2014-08-26 11:49:56 UTC
(In reply to comment #2)
> Created an attachment (id=284326) [details] [review]
> Add context menu entries for media elements
> 
> This commit adds the following new context menu entries for video and
> audio elements:
> 
> * Save Media As...
> * Copy Media Address
> * Play Media

How can you play media if we don't expose API for that?

> These context menu entries intentionally mirror the entries we use for
> images.

I think open audio/video in new tab/window would also make sense, more similar to a link than to an image.

> It would be nicer to use the labels "Save Video As...", "Save Audio
> As..." etc. but I didn't spot an obivous way to determine the type of
> media.

Right, we should probably add webkit_hit_test_result_get_media_type() or something like that, but even in that case, we would need to use the items from the default context menu for actions not exposed in the API (play, pause, mute, fullscreen, toggle media controls, etc). So, for now we can look for video items in the default context menu to figure out whether it's a video element or not.
Comment 6 Carlos Garcia Campos 2014-08-26 11:51:42 UTC
Created attachment 284499 [details] [review]
A different approach to add media actions to context menu

This is currently broken for non English locales due to a bug in WebKit, the only problem is that you would see Audio instead of Video in the context menu entries, see https://bugs.webkit.org/show_bug.cgi?id=136249
Comment 7 Michael Catanzaro 2014-08-26 14:26:07 UTC
Review of attachment 284499 [details] [review]:

Yay, this is better than my approach.

::: src/ephy-window.c
@@ +1786,3 @@
 						    webkit_context_menu_item_new_separator ());
+		add_item_to_context_menu (context_menu, input_methods_item);
+		add_item_to_context_menu (context_menu, unicode_item);

The WebKitContextMenuItem in webkit_context_menu_append() is not nullable, so either this is wrong or else the conditional above if (input_methods_item || unicode_item) is also unnecessary.

(It also looks unrelated.)
Comment 8 Michael Catanzaro 2014-08-26 14:27:39 UTC
(In reply to comment #4)
> But we don't have any public headers, so that boilerplate isn't needed
> anywhere. I guess this is a remnant from when we used to have extensions?  Are
> we purposefully keeping a distinction between headers that might in the future
> be public if we were to have extensions again?  I notice the makefiles have
> separate sections for installed and uninstalled headers (none of which get
> installed) which I was thinking about cleaning up....

Carlos, what do you think about this? ^

(In reply to comment #5)
> I think open audio/video in new tab/window would also make sense, more similar
> to a link than to an image.

That's what my "Play Media" entry does, which is really silly. It was intended to parallel "View Image" but I realized "View Media" doesn't work for audio.  Your approach is better, but we should also rename "View Image" to "Open Image in New Tab." I'll do that in another bug.
Comment 9 Carlos Garcia Campos 2014-08-26 15:10:15 UTC
(In reply to comment #7)
> Review of attachment 284499 [details] [review]:
> 
> Yay, this is better than my approach.
> 
> ::: src/ephy-window.c
> @@ +1786,3 @@
>                              webkit_context_menu_item_new_separator ());
> +        add_item_to_context_menu (context_menu, input_methods_item);
> +        add_item_to_context_menu (context_menu, unicode_item);
> 
> The WebKitContextMenuItem in webkit_context_menu_append() is not nullable, so
> either this is wrong or else the conditional above if (input_methods_item ||
> unicode_item) is also unnecessary.

add_item_to_context_menu returns early if the item is NULL.

> (It also looks unrelated.)

It uses a new method added in this commit, I can split it, but it's related.
Comment 10 Carlos Garcia Campos 2014-08-26 15:10:57 UTC
(In reply to comment #8)
> (In reply to comment #4)
> > But we don't have any public headers, so that boilerplate isn't needed
> > anywhere. I guess this is a remnant from when we used to have extensions?  Are
> > we purposefully keeping a distinction between headers that might in the future
> > be public if we were to have extensions again?  I notice the makefiles have
> > separate sections for installed and uninstalled headers (none of which get
> > installed) which I was thinking about cleaning up....
> 
> Carlos, what do you think about this? ^

Remove the single header check and leave the begin/end macros.

> (In reply to comment #5)
> > I think open audio/video in new tab/window would also make sense, more similar
> > to a link than to an image.
> 
> That's what my "Play Media" entry does, which is really silly. It was intended
> to parallel "View Image" but I realized "View Media" doesn't work for audio. 
> Your approach is better, but we should also rename "View Image" to "Open Image
> in New Tab." I'll do that in another bug.

Ok.
Comment 11 Michael Catanzaro 2014-08-26 16:00:46 UTC
(In reply to comment #9)
> add_item_to_context_menu returns early if the item is NULL.

Oops, yes.
Comment 12 Michael Catanzaro 2014-08-26 16:03:07 UTC
Comment on attachment 284325 [details] [review]
popup-commands: add include guards

Attachment 284325 [details] pushed as fb97f9f - popup-commands: add include guards