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 619207 - Support Web-M videos
Support Web-M videos
Status: RESOLVED FIXED
Product: totem
Classification: Core
Component: YouTube plugin
unspecified
Other Linux
: Normal normal
: ---
Assigned To: General Totem maintainer(s)
General Totem maintainer(s)
: 614845 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-05-20 15:45 UTC by Bastien Nocera
Modified: 2010-08-09 22:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use Web-M videos when available (3.23 KB, patch)
2010-07-25 15:23 UTC, Bastien Nocera
none Details | Review
Use libsoup directly to load video pages in the YouTube plugin (7.23 KB, patch)
2010-08-09 08:55 UTC, Philip Withnall
committed Details | Review

Description Bastien Nocera 2010-05-20 15:45:13 UTC
"use YouTube's search feature and append &webm=1 to the URL, like this: http://www.youtube.com/results?search_query=web&webm=1"

From:
http://googlesystem.blogspot.com/2010/05/how-to-play-webm-video-on-youtube.html
Comment 1 Philip Withnall 2010-05-20 21:30:41 UTC
This would have to wait until all YouTube videos have been re-encoded in WebM format. The change would then be a simple one to the get_fmt_param() function in totem-youtube.c.
Comment 2 Bastien Nocera 2010-07-25 15:23:30 UTC
Created attachment 166523 [details] [review]
Use Web-M videos when available

Prefer Web-M videos, to MP4 videos, and MP4 videos to FLV, or
mobile videos.
Comment 3 Bastien Nocera 2010-07-25 15:24:33 UTC
Just need to figure out the possible bitrates for the videos, to fill in the get_best_uri() function.
Comment 4 Bastien Nocera 2010-07-25 15:25:16 UTC
*** Bug 614845 has been marked as a duplicate of this bug. ***
Comment 5 Bastien Nocera 2010-07-25 15:25:51 UTC
The different formats are listed in:
http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs
Comment 6 Philip Withnall 2010-08-01 16:38:39 UTC
My patch for this is almost complete. I've figured out what the problem is with certain formats: cookies. When we request the video page to extract the format map, YouTube sets some cookies, which are stored in a SoupCookieJar owned by the GVFS HTTP daemon. Since we request multiple video pages for each search, we send the cookies back to YouTube for all except one of the videos, which modifies the playback URIs we're given. The modified playback URIs require the same cookies to be sent to return the video. However, Totem uses souphttpsrc to get the video from the playback URI, which uses a different SoupCookieJar, so doesn't send back the correct (or any) cookies.

Probably the best solution is to prefer giosrc to souphttpsrc, so that the video downloads use the correct cookies.
Comment 7 Philip Withnall 2010-08-01 16:53:01 UTC
commit 55ff6cec4ecd42e85dd271e90461c8b4ac139efa
Author: Philip Withnall <philip@tecnocode.co.uk>
Date:   Sun Aug 1 17:47:06 2010 +0100

    Bug 619207 — Support Web-M videos
    
    Support all YouTube's video formats in the YouTube plugin. Closes: bgo#619207

 src/plugins/youtube/totem-youtube.c |   69 ++++++++++++++++++++++++++++++++---
 1 files changed, 64 insertions(+), 5 deletions(-)
Comment 8 Philip Withnall 2010-08-01 16:57:46 UTC
Tim, what would be the best way to prefer giosrc over souphttpsrc for YouTube videos? It there any reason that giosrc is ranked as a secondary element anyway? I was thinking about just changing the plugin rankings on activation of the YouTube plugin, but that would introduce a GStreamer dependency to the plugin.
Comment 9 Philip Withnall 2010-08-01 17:31:47 UTC
Bastien, do you want me to commit the patch to gnome-2-30 as well?
Comment 10 Bastien Nocera 2010-08-01 17:43:38 UTC
Hmm, I would be happy if we could manage to get the cookie problem sorted out.

souphttpsrc can have its cookies set:
  cookies             : HTTP request cookies
                        flags: readable, writable
                        Boxed pointer of type "GStrv"

The only problem left would be reading them from gio's http backend's cookie jar.
Comment 11 Philip Withnall 2010-08-01 21:08:37 UTC
(In reply to comment #10)
> The only problem left would be reading them from gio's http backend's cookie
> jar.

That's quite a big problem. As far as I know, there's no provision in the GIO API for retrieving information like that. The cookie jar is only stored in memory, and isn't exposed outside the HTTP backend.
Comment 12 Bastien Nocera 2010-08-01 21:22:28 UTC
Right, we might need to use soup directly then, instead of going through GIO for that.

I had a similar problem when using GIO but wanting to change the user-agent (for totem-pl-parser ITMS support).
Comment 13 Philip Withnall 2010-08-02 12:24:09 UTC
(In reply to comment #12)
> Right, we might need to use soup directly then, instead of going through GIO
> for that.
> 
> I had a similar problem when using GIO but wanting to change the user-agent
> (for totem-pl-parser ITMS support).

That would be possible, but would still require some way of injecting the cookies in the souphttpsrc in the pipeline created by playbin2.
Comment 14 Bastien Nocera 2010-08-02 12:40:12 UTC
(In reply to comment #13)
<snip>
> That would be possible, but would still require some way of injecting the
> cookies in the souphttpsrc in the pipeline created by playbin2.

We can add an accessor for that to the bacon widget, just as we have for the user-agent configuration, or we could always load the libsoup-gnome cookies in the video widget.
Comment 15 Philip Withnall 2010-08-08 23:31:12 UTC
New suggested solution: use libsoup directly in resolve_t_param(), instead of going through GIO. Do not store any cookies and hence don't transmit any cookies back to the server. This should hopefully get the videos working again and improve privacy.

If it doesn't work, we can always try storing the cookies and passing them to bvw to request the videos anyway.
Comment 16 Philip Withnall 2010-08-09 08:55:19 UTC
Created attachment 167406 [details] [review]
Use libsoup directly to load video pages in the YouTube plugin

Here's a patch which does exactly that, and seems to work. It needs a bit more testing of cancellation before it can be committed, though.
Comment 17 Philip Withnall 2010-08-09 08:55:45 UTC
Comment on attachment 166523 [details] [review]
Use Web-M videos when available

(Marking old patch as obsolete.)
Comment 18 Philip Withnall 2010-08-09 20:42:47 UTC
commit d61fd2d66bc4d45d0d8c86848599c8385f06e4a1
Author: Philip Withnall <philip@tecnocode.co.uk>
Date:   Mon Aug 9 09:53:09 2010 +0100

    Use libsoup directly to load video pages in the YouTube plugin
    
    This means we can ignore cookies, and don't encounter the cookie sharing
    problem we previously had between libsoup and gvfs. Closes: bgo#619207

 configure.in                        |    7 +++++
 src/plugins/youtube/Makefile.am     |    5 +++-
 src/plugins/youtube/totem-youtube.c |   51 ++++++++++++++++++++++++----------
 3 files changed, 47 insertions(+), 16 deletions(-)
Comment 19 Philip Withnall 2010-08-09 22:02:21 UTC
Cherry-picked into gnome-2-30 and gnome-2-32 too.