我如何.requestFullscreen
(或.-volume
)来自其他元素的视频?
我尝试使用this-as
宏和getElementByID
,但是当我尝试调用此函数时,我的编辑器和Figwheel不满意。
答案 0 :(得分:0)
这是一种方法:
(defn foo []
(let [v (atom nil)]
[:div
[:button
{:on-click
(fn [e]
(when @v
(cond
(.-requestFullscreen @v) (.requestFullscreen @v)
(.-mozRequestFullScreen @v) (.mozRequestFullScreen @v)
(.-webkitRequestFullScreen @v) (.webkitRequestFullscreen @v)
:else nil)))}
"Fullscreen"]
[:video
{:ref
(fn [elem]
(when elem
(reset! v elem)))
:src "https://archive.org/download/WebmVp8Vorbis/webmvp8.webm"}
"Sorry, your browser doesn't support embedded videos."]]))