emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using xwidget to play youtube videos


From: Lars Ingebrigtsen
Subject: Re: Using xwidget to play youtube videos
Date: Mon, 22 Feb 2016 14:56:10 +1100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

I've taken another short stab at playing with xwidget, and I can't
really make heads or tails of it, I'm afraid.  Patch to eww below.

First of all, it seems like all the xwidget functions are geared towards
only being displayed in an xwidget buffer.  The xwidget functions rename
buffers willy-nilly when just inserting an xwidget into a buffer, and
that should not happen.  There are also hard-coded callbacks in the
xwidgets for adjusting the size and ... stuff ... that don't make any
sense in anything but xwidget buffers, either.

The xwidget core code has to be separated out from the xwidget mode
code, and the latter should set the callbacks it wants to use.

I think that's probably easily doable, but it would be nice if someone
who knew the code and what it was trying to do did that.  :-)

Second of all, it's quite glitchy.  Even if you manage to somehow insert
an xwidget into your buffer, scrolling around in the buffer sometimes
makes the xwidget show up twice, or no times, or leaves half the widget
displayed and half not.

So, er...  this stuff doesn't really seem finished.  :-)  I think it's
exciting, but it needs work.  Should this be in emacs-25?

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 7f9f4fa..3d94508 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -426,6 +426,7 @@ eww-display-html
               '((title . eww-tag-title)
                 (form . eww-tag-form)
                 (input . eww-tag-input)
+                (iframe . eww-tag-iframe)
                 (button . eww-form-submit)
                 (textarea . eww-tag-textarea)
                 (select . eww-tag-select)
@@ -2000,6 +2001,16 @@ eww-restore-desktop
 (add-to-list 'desktop-buffer-mode-handlers
              '(eww-mode . eww-restore-desktop))
 
+(defun eww-tag-iframe (dom)
+  (when (fboundp 'make-xwidget)
+    (require 'xwidget)
+    (insert "-")
+    (let ((xw (xwidget-insert (1- (point)) 'webkit-osr  (current-buffer)
+                              (string-to-number (dom-attr dom 'width))
+                              (string-to-number (dom-attr dom 'height)))))
+      (xwidget-webkit-goto-uri xw (dom-attr dom 'src))
+      (insert "---"))))
+
 ;;; Isearch support
 
 (defun eww-isearch-next-buffer (&optional _buffer wrap)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]