Weblocks and HTML5 video?

70 views
Skip to first unread message

petter

unread,
Feb 21, 2013, 4:34:13 PM2/21/13
to webl...@googlegroups.com
I tried the following snippet to generate an embedded video:

(defun init-user-session (comp)
  (setf (cl-who:html-mode) :html5)
  (setf (composite-widgets comp)
        (make-widget 
         (lambda (&rest args)
           (declare (ignore args)) 
           (with-html
             (:body 
              (:html
               (:body
                (:p "video test")
                ;; I would expect :controls t to return controls, but it returns controls='controls'
                (:video :width 320 :height 240 :controls nil
                        (:source :src "/pub/images/video.mp4" :type "video/mp4")
                        (:source :src "/pub/images/video.ogg" :type "video/ogg")
                        (:source :src "/pub/images/video.webm" :type "video/webm")
                        (:object :data "/pub/images/video.webm" :widht 320 :height 240
                                 (:embed :src "/pub/images/video.swf" :widht 320 :height 240)))))))))))

But it does not work. All I get is a black box. Also, if I right click on the black box in Chromium I can save the video (webm) which I can play using mplayer. If I save the generated HTML to a file, remove "/pub/images/" and put the video files in the same directory I can open up the file and view the video i Chromium. 

Did anybody else succeed serving video from Weblocks?

o_z

unread,
Feb 21, 2013, 6:12:21 PM2/21/13
to webl...@googlegroups.com


четверг, 21 февраля 2013 г., 23:34:13 UTC+2 пользователь petter написал:
Have you seen working example ? Does similar code works on other platforms (under apache or nginx) ?
You can put working html example into /pub/ directory and open it in browser. The next step would be to serve this html from weblocks, for example with 
(write-string "<html ... >" *weblocks-output-stream*) 

Scott L. Burson

unread,
Feb 21, 2013, 6:34:53 PM2/21/13
to webl...@googlegroups.com

As for the "controls='controls'" thing, that is done on boolean attributes for XHTML compatibility.  I suppose it could be turned off for HTML5, but I'm fairly sure it doesn't cause any problems.

Also, you misspelled "width" twice :-)

I've never tried to do this, so I'm just guessing, but is it possible that the browser is trying to use some streaming protocol that Hunchentoot doesn't support?  I would use Wireshark to see exactly what the browser is sending.  -- Maybe if you specified HTTP, as in "http://pub/images/video.mp4", it would override the browser's default.

-- Scott

petter

unread,
Feb 21, 2013, 6:58:50 PM2/21/13
to webl...@googlegroups.com

petter

unread,
Feb 21, 2013, 7:10:10 PM2/21/13
to webl...@googlegroups.com


On Friday, February 22, 2013 12:12:21 AM UTC+1, o_z wrote:


четверг, 21 февраля 2013 г., 23:34:13 UTC+2 пользователь petter написал:
I tried the following snippet to generate an embedded video:

(defun init-user-session (comp)
  (setf (cl-who:html-mode) :html5)
  (setf (composite-widgets comp)
        (make-widget 
         (lambda (&rest args)
           (declare (ignore args)) 
           (with-html
             (:body 
              (:html
               (:body
                (:p "video test")
                ;; I would expect :controls t to return controls, but it returns controls='controls'
                (:video :width 320 :height 240 :controls nil
                        (:source :src "/pub/images/video.mp4" :type "video/mp4")
                        (:source :src "/pub/images/video.ogg" :type "video/ogg")
                        (:source :src "/pub/images/video.webm" :type "video/webm")
                        (:object :data "/pub/images/video.webm" :widht 320 :height 240
                                 (:embed :src "/pub/images/video.swf" :widht 320 :height 240)))))))))))

But it does not work. All I get is a black box. Also, if I right click on the black box in Chromium I can save the video (webm) which I can play using mplayer. If I save the generated HTML to a file, remove "/pub/images/" and put the video files in the same directory I can open up the file and view the video i Chromium. 
Have you seen working example ? Does similar code works on other platforms (under apache or nginx) ?

Yes. If I save the HTML and change the paths I can open up the file and view the video in the browser.
 
You can put working html example into /pub/ directory and open it in browser. The next step would be to serve this html from

I created a symlink to /pub. Then did a save as for the HTML code and opened the file and the video is working. So believe that the HTML should be ok.


 

petter

unread,
Feb 21, 2013, 7:31:47 PM2/21/13
to webl...@googlegroups.com


On Friday, February 22, 2013 12:34:53 AM UTC+1, Scott L. Burson wrote:
On Thu, Feb 21, 2013 at 1:34 PM, petter <petter...@gmail.com> wrote:
I tried the following snippet to generate an embedded video:

(defun init-user-session (comp)
  (setf (cl-who:html-mode) :html5)
  (setf (composite-widgets comp)
        (make-widget 
         (lambda (&rest args)
           (declare (ignore args)) 
           (with-html
             (:body 
              (:html
               (:body
                (:p "video test")
                ;; I would expect :controls t to return controls, but it returns controls='controls'
                (:video :width 320 :height 240 :controls nil
                        (:source :src "/pub/images/video.mp4" :type "video/mp4")
                        (:source :src "/pub/images/video.ogg" :type "video/ogg")
                        (:source :src "/pub/images/video.webm" :type "video/webm")
                        (:object :data "/pub/images/video.webm" :widht 320 :height 240
                                 (:embed :src "/pub/images/video.swf" :widht 320 :height 240)))))))))))

But it does not work. All I get is a black box. Also, if I right click on the black box in Chromium I can save the video (webm) which I can play using mplayer. If I save the generated HTML to a file, remove "/pub/images/" and put the video files in the same directory I can open up the file and view the video i Chromium.

As for the "controls='controls'" thing, that is done on boolean attributes for XHTML compatibility.  I suppose it could be turned off for HTML5, but I'm fairly sure it doesn't cause any problems.

Also, you misspelled "width" twice :-)

Thanks, but it didn't change the behavior.

I've never tried to do this, so I'm just guessing, but is it possible that the browser is trying to use some streaming protocol that Hunchentoot doesn't support?  I would use Wireshark to see exactly what the browser is sending.  -- Maybe if you

I suspect that is what might be happening. Like I said saving the HTML and opening it in the browser works.
 
specified HTTP, as in "http://pub/images/video.mp4", it would override the browser's default

If I do this it will not show the video. Only a black box with the controls. If I open up the files directly in the browser it will work so it seems like it's related to the way Hunchentoot is serving the video.
-- Scott

Scott L. Burson

unread,
Feb 21, 2013, 10:57:04 PM2/21/13
to webl...@googlegroups.com

Oops -- stupid mistake on my part -- you either have to put in a hostname, as in "http://localhost/pub/images/video.mp4", or not use a double slash, as in  "http:/pub/images/video.mp4".  I'm not 100% sure the latter works, but I think it should.

-- Scott

petter

unread,
Feb 22, 2013, 12:41:56 AM2/22/13
to webl...@googlegroups.com
I did use the hostname when I tested with the full path to the actual mp4 file.

http://www-local:8080/pub/images/movie.mp4 I get a video player interface with black content which does not respond when I hit the play button
http://techslides.com/demos/sample-videos/small.mp4 I get the same player interface with video content
If I download small.mp4 and put it into the  images directory and try
http://www-local:8080/pub/images/small.mp4 I get a video player interface with black content which does not respond when I hit the play button


 
-- Scott

Scott L. Burson

unread,
Feb 22, 2013, 2:14:51 AM2/22/13
to webl...@googlegroups.com
On Thu, Feb 21, 2013 at 9:41 PM, petter <petter...@gmail.com> wrote:

http://www-local:8080/pub/images/movie.mp4 I get a video player interface with black content which does not respond when I hit the play button
http://techslides.com/demos/sample-videos/small.mp4 I get the same player interface with video content
If I download small.mp4 and put it into the  images directory and try
http://www-local:8080/pub/images/small.mp4 I get a video player interface with black content which does not respond when I hit the play button

Well, then, I return to my previous suggestion: use Wireshark to see exactly what the browser is sending to the server.

If you haven't used Wireshark before, this may take some study, but it's an extremely useful tool that you would do well to have a little familiarity with.

-- Scott
 

petter

unread,
Feb 22, 2013, 2:50:23 AM2/22/13
to webl...@googlegroups.com
I' more familiar with tcpdump, even though I'm not that familiar with the actual HTTP protocol.

I could try to serve the same file with plain Hunchentoot and see if the results are the same... 

petter

unread,
Feb 22, 2013, 12:24:50 PM2/22/13
to webl...@googlegroups.com

The two plain Hunchentooth handlers below seem work to play video at url http://www:4242/html and  http://www:4242/video?ext=mp4 (or ext=webm or ext=ogv) and I put the files under Hunchentooths root.


(hunchentoot:define-easy-handler (fun-video :uri "/video") (ext)
  (let* ((ext (or ext "mp4"))
         (vtype (cadr (assoc ext '(("mp4" "mp4") ("webm" "webm") ("ogv" "ogg")) :test #'equal))))
    (setf (hunchentoot:content-type*) (concatenate 'string "video/" vtype))
    (copy-file
     (make-pathname :directory '(:absolute "tmp") :name "gizmo" :type ext)
     (hunchentoot:send-headers))))


(hunchentoot:define-easy-handler (fun-text :uri "/html") ()
  (setf (hunchentoot:content-type*) "text/html")
  (cl-who:with-html-output (*standard-output* nil :prologue t)
    (:html
     (:body
      (:video
       (:source :src "/tmp/gizmo.mp4" :type "video/mp4")
       (:source :src "/tmp/gizmo.webm" :type "video/webm")
       (:source :src "/tmp/gizmo.ogv" :type "video/ogg"))))))


However, in Weblocks I get some kind of crash:
[2013-02-22 18:13:15 [ERROR]] Couldn't write to #<SB-SYS:FD-STREAM
                                                  for "socket 172.30.30.252:8080
, peer: 172.30.30.252:37767"
                                                  {1002D20003}>:
                                Connection reset by peer
0: (SB-DEBUG::MAP-BACKTRACE
    #<CLOSURE (LAMBDA # :IN BACKTRACE) {10060CAC4B}>
    :START
    0
    :COUNT
    4611686018427387903)

Seem to be a pretty big number... Need to debug this further.


The files I've used for testing can be downloaded from:

http://www.808.dk/pics/video/gizmo.mp4
http://www.808.dk/pics/video/gizmo.webm
http://www.808.dk/pics/video/gizmo.ogv

petter

unread,
Feb 22, 2013, 12:55:25 PM2/22/13
to webl...@googlegroups.com

Please ignore this thread. It seems like I managed to corrupt the file when I generated the file I used for the Weblocks test. I copied the files from my Hunchentooth test and now it's working fine. Sorry about the confusion and noise...
Reply all
Reply to author
Forward
0 new messages