From 6ff80e95f428c15f3d80b0ecf23491304ecb87c9 Mon Sep 17 00:00:00 2001
From: David Botton
Returns true if browser claims support of a media type. Browsers report possibility but not guarantees of being able to support a -media type. - Common values: - video/ogg - video/mp4 - video/webm - audio/mpeg - audio/ogg - audio/mp4 - audio/mp3
+media type. - Common values, including codecs:
+ Common values:
+ video/ogg
+ video/mp4
+ video/webm
+ audio/mpeg
+ audio/ogg
+ audio/mp4
+ audio/mp3
+
+ Common values, including codecs:
video/ogg; codecs="theora, vorbis"
video/mp4; codecs="avc1.4D401E, mp4a.40.2"
video/webm; codecs="vp8.0, vorbis"
@@ -3202,6 +3203,17 @@ media type.
+CLOG-Multimedia - Event Handlers
+
+The standard event order for a normal file load is:
+ On_Load_Start
+ On_Duration_Change
+ On_Loaded_Meta_Data
+ On_Loaded_Data
+ On_Progress
+ On_Can_Play
+ On_Can_Play_Though
+
diff --git a/tutorial/15-tutorial.lisp b/tutorial/15-tutorial.lisp
index 9432437..b41e451 100644
--- a/tutorial/15-tutorial.lisp
+++ b/tutorial/15-tutorial.lisp
@@ -5,10 +5,29 @@
(in-package :clog-user)
(defun on-new-window (body)
- (create-video body :source "https://www.w3schools.com/html/mov_bbb.mp4")
- (create-audio body :source "https://www.w3schools.com/html/horse.ogg")
-
- (run body))
+
+ (let* ((vid (create-video body :source "https://www.w3schools.com/html/mov_bbb.mp4"))
+ (tmp (create-br body))
+ (vpl (create-button body :content ">"))
+ (vst (create-button body :content "||"))
+ (vlc (create-form-element body :input))
+ (tmp (create-hr body))
+ (aud (create-audio body :source "https://www.w3schools.com/html/horse.ogg"))
+ (tmp (create-br body))
+ (apl (create-button body :content ">"))
+ (ast (create-button body :content "||"))
+ (alc (create-form-element body :input))
+ (tmp (create-hr body)))
+
+ (set-on-click vpl (lambda (obj)(play-media vid)))
+ (set-on-click apl (lambda (obj)(play-media aud)))
+ (set-on-click vst (lambda (obj)(pause-media vid)))
+ (set-on-click ast (lambda (obj)(pause-media aud)))
+
+ (set-on-time-update vid (lambda (obj)(setf (value vlc) (media-position vid))))
+ (set-on-time-update aud (lambda (obj)(setf (value alc) (media-position aud))))
+
+ (run body)))
(defun start-tutorial ()
"Start turtorial."
diff --git a/tutorial/README.md b/tutorial/README.md
index 1a07031..44cf241 100644
--- a/tutorial/README.md
+++ b/tutorial/README.md
@@ -47,3 +47,4 @@ Tutorial Summary
- 12-tutorial.lisp - Running a website in CLOG (routing)
- 13-tutorial/ - Flying Solo - A minimalist CLOG project
- 14-tutorial.lisp - Local (persistent) and Session client side storage
+- 15-tutorial.lisp - Multi-media