[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bongo-devel] Re: YouTube videos
From: |
Daniel Jensen |
Subject: |
[bongo-devel] Re: YouTube videos |
Date: |
Thu, 15 Mar 2007 21:51:13 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.93 (gnu/linux) |
Daniel Brockman <address@hidden> writes:
> It would be nice if the file was downloaded directly to the
> file inserted into Bongo, so that you could start playing it
> immediately despite it not being fully downloaded.
>
> I don't know how to tell `url-retrieve' to download directly
> into a specific file --- do you?
That is a good idea, but I don't know if Emacs can do it. I guess it's
easier to use an external command for that. I found some interesting
code in mm-url.el, though it looks like it needs some work.
However, my connection is not good enough for watching movies like
this. There will be end-of-file errors. I might as well download the
whole thing before I watch it.
Another approach that I like better is to play the video file like a
stream. If the player knows what it's doing, it will do buffering for
me, right?
(defun bongo-insert-youtube-url (youtube-url)
(interactive
(list (bongo-read-uri "Youtube URL")))
(with-current-buffer (url-retrieve-synchronously youtube-url)
(re-search-forward bongo-youtube-video-regexp)
(let ((real-uri (concat bongo-youtube-base-url (match-string 1))))
(goto-char (point-min))
(re-search-forward bongo-youtube-title-regexp)
(bongo-insert-uri real-uri (match-string 1)))
(kill-buffer (current-buffer))))
Sadly, it looks like VLC cannot handle this; it barfs on EOF. It does
work all the way with Mplayer. (Not tested with the back-end, I don't
have it installed.)