0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

JavaScriptで全画面(フルスクリーン)にする【YouTube】

Posted at

TL;DR

  1. フルスクリーンにできるようWebサーバーを起動

    # wget https://github.com/msoap/shell2http/releases/download/v1.14.1/shell2http_1.14.1_linux_amd64.deb
    # sudo apt install xdotool ./shell2http_1.14.1_linux_amd64.deb
    shell2http /fullscreen "DISPLAY=:0 xdotool key f"
    
  2. videoにフォーカスして、フルスクリーンにする

    document.querySelector('video').focus()
    setTimeout(() => fetch('http://localhost:8080/fullscreen'), 1000)
    

Google Cloud Skills Boostで動かすと便利です!

SkillsBoost.user.js
// ==UserScript==
// @name         SkillsBoost
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.youtube.com/embed/*?playsinline=1&controls=2&modestbranding=1&iv_load_policy=3&rel=0&enablejsapi=1&autoplay=0&origin=https%3A%2F%2Fwww.cloudskillsboost.google&widgetid=1
// @icon         https://www.google.com/s2/favicons?sz=64&domain=cloudskillsboost.google
// @connect      localhost
// @grant        none
// ==/UserScript==

document.querySelector('video').focus()
setTimeout(() => fetch('http://localhost:8080/fullscreen'), 1000)
setTimeout(() => document.querySelector('.ytp-play-button').click(), 1000)

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?