Skip to content

Instantly share code, notes, and snippets.

@yukulele
Last active March 29, 2025 10:40

Revisions

  1. yukulele revised this gist Mar 18, 2025. 2 changed files with 7 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion Twitter native video player.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Twitter native video player

    Replace the user-unfriendly Twitter video player with the browser's native video player.
    Replace the user-unfriendly Twitter and Blusky video player with the browser's native video player.

    This allows you to:
    * seek backward/forward with the <kbd title="left">←</kbd> / <kbd title="right">→</kbd> keys
    7 changes: 6 additions & 1 deletion twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -5,9 +5,10 @@
    // @match https://mobile.twitter.com/*
    // @match https://x.com/*
    // @match https://mobile.x.com/*
    // @match https://bsky.app/*
    // @grant GM.getValue
    // @grant GM.setValue
    // @version 1.0.11
    // @version 1.1.11
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace the user-unfriendly Twitter video player with the browser's native video player. This allows you to: seek backward/forward with the left/right keyboard keys, change the volume with the up/down keyboard keys, switch to full screen with double-click of f key, access the video's contextual menu, change the playback speed with the <kbd>+</kbd>, <kbd>-</kbd> and <kbd>0</kbd> keys or via the contextual menu, share the playback speed between videos.
    @@ -26,7 +27,10 @@ async function nativePlayer(video) {
    video.addEventListener('mouseenter', () => showControls(video))
    video.addEventListener('mouseleave', () => hideControls(video))
    video.addEventListener('keydown', e => keyboard(e, video))
    video.style.position = 'relative'
    video.style.zIndex = 1
    video.muted = false
    showControls(video)
    video.focus()
    }

    @@ -56,6 +60,7 @@ new MutationObserver(mutationsList => {
    for (var mutation of mutationsList) {
    if (mutation.type !== 'childList') continue
    for (const node of mutation.addedNodes) {
    if (node instanceof HTMLVideoElement) return void nativePlayer(node)
    if (!(node instanceof HTMLElement)) continue
    for (const video of node.querySelectorAll('video')) nativePlayer(video)
    }
  2. yukulele revised this gist May 20, 2024. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -3,9 +3,11 @@
    // @namespace https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @match https://twitter.com/*
    // @match https://mobile.twitter.com/*
    // @match https://x.com/*
    // @match https://mobile.x.com/*
    // @grant GM.getValue
    // @grant GM.setValue
    // @version 1.0.10
    // @version 1.0.11
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace the user-unfriendly Twitter video player with the browser's native video player. This allows you to: seek backward/forward with the left/right keyboard keys, change the volume with the up/down keyboard keys, switch to full screen with double-click of f key, access the video's contextual menu, change the playback speed with the <kbd>+</kbd>, <kbd>-</kbd> and <kbd>0</kbd> keys or via the contextual menu, share the playback speed between videos.
  3. yukulele revised this gist Nov 29, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    // @match https://mobile.twitter.com/*
    // @grant GM.getValue
    // @grant GM.setValue
    // @version 1.0.9
    // @version 1.0.10
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace the user-unfriendly Twitter video player with the browser's native video player. This allows you to: seek backward/forward with the left/right keyboard keys, change the volume with the up/down keyboard keys, switch to full screen with double-click of f key, access the video's contextual menu, change the playback speed with the <kbd>+</kbd>, <kbd>-</kbd> and <kbd>0</kbd> keys or via the contextual menu, share the playback speed between videos.
    @@ -43,7 +43,7 @@ function toggleFullscreen(video) {
    video.requestFullscreen()
    }

    function keyboard(key, video) {
    function keyboard(e, video) {
    if (e.key === 'f') return toggleFullscreen(video)
    if (e.key === '0' || e.code === 'Numpad0') return video.playbackRate = 1
    if (e.key === '+') return video.playbackRate += 0.05
  4. yukulele revised this gist Oct 20, 2023. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    // @match https://mobile.twitter.com/*
    // @grant GM.getValue
    // @grant GM.setValue
    // @version 1.0.8
    // @version 1.0.9
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace the user-unfriendly Twitter video player with the browser's native video player. This allows you to: seek backward/forward with the left/right keyboard keys, change the volume with the up/down keyboard keys, switch to full screen with double-click of f key, access the video's contextual menu, change the playback speed with the <kbd>+</kbd>, <kbd>-</kbd> and <kbd>0</kbd> keys or via the contextual menu, share the playback speed between videos.
    @@ -23,7 +23,7 @@ async function nativePlayer(video) {
    video.addEventListener('ratechange', () => GM.setValue('playbackRate', video.playbackRate))
    video.addEventListener('mouseenter', () => showControls(video))
    video.addEventListener('mouseleave', () => hideControls(video))
    video.addEventListener('keydown', e => keyboard(e.key, video))
    video.addEventListener('keydown', e => keyboard(e, video))
    video.style.zIndex = 1
    video.focus()
    }
    @@ -44,10 +44,10 @@ function toggleFullscreen(video) {
    }

    function keyboard(key, video) {
    if (key === 'f') return toggleFullscreen(video)
    if (key === '0') return video.playbackRate = 1
    if (key === '+') return video.playbackRate += 0.05
    if (key === '-') return video.playbackRate -= 0.05
    if (e.key === 'f') return toggleFullscreen(video)
    if (e.key === '0' || e.code === 'Numpad0') return video.playbackRate = 1
    if (e.key === '+') return video.playbackRate += 0.05
    if (e.key === '-') return video.playbackRate -= 0.05
    }

    new MutationObserver(mutationsList => {
  5. yukulele revised this gist Oct 6, 2023. 1 changed file with 20 additions and 7 deletions.
    27 changes: 20 additions & 7 deletions twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,9 @@
    // @namespace https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @match https://twitter.com/*
    // @match https://mobile.twitter.com/*
    // @grant none
    // @version 1.0.7
    // @grant GM.getValue
    // @grant GM.setValue
    // @version 1.0.8
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace the user-unfriendly Twitter video player with the browser's native video player. This allows you to: seek backward/forward with the left/right keyboard keys, change the volume with the up/down keyboard keys, switch to full screen with double-click of f key, access the video's contextual menu, change the playback speed with the <kbd>+</kbd>, <kbd>-</kbd> and <kbd>0</kbd> keys or via the contextual menu, share the playback speed between videos.
    @@ -15,16 +16,28 @@
    // @inject-into auto
    // ==/UserScript==

    function nativePlayer(video) {
    video.playbackRate = localStorage.playbackRate || 1
    video.addEventListener('ratechange', () => localStorage.playbackRate = video.playbackRate)
    video.addEventListener('mouseenter', () => video.controls = true)
    video.addEventListener('mouseleave', () => video.controls = false)
    let timeout

    async function nativePlayer(video) {
    video.playbackRate = await GM.getValue('playbackRate') ?? 1
    video.addEventListener('ratechange', () => GM.setValue('playbackRate', video.playbackRate))
    video.addEventListener('mouseenter', () => showControls(video))
    video.addEventListener('mouseleave', () => hideControls(video))
    video.addEventListener('keydown', e => keyboard(e.key, video))
    video.style.zIndex = 1
    video.focus()
    }

    function showControls(video) {
    clearTimeout(timeout)
    video.controls = true
    }

    function hideControls(video) {
    clearTimeout(timeout)
    timeout = setTimeout(() => video.controls = false, 1000)
    }

    function toggleFullscreen(video) {
    if (document.fullscreenElement) return document.exitFullscreen()
    video.requestFullscreen()
  6. yukulele revised this gist Nov 9, 2022. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions twitter-native-video-player-icon.svg
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
  7. yukulele revised this gist Nov 9, 2022. 2 changed files with 4 additions and 6 deletions.
    8 changes: 3 additions & 5 deletions twitter-native-video-player-icon.svg
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
    2 changes: 1 addition & 1 deletion twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    // @match https://twitter.com/*
    // @match https://mobile.twitter.com/*
    // @grant none
    // @version 1.0.6
    // @version 1.0.7
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace the user-unfriendly Twitter video player with the browser's native video player. This allows you to: seek backward/forward with the left/right keyboard keys, change the volume with the up/down keyboard keys, switch to full screen with double-click of f key, access the video's contextual menu, change the playback speed with the <kbd>+</kbd>, <kbd>-</kbd> and <kbd>0</kbd> keys or via the contextual menu, share the playback speed between videos.
  8. yukulele revised this gist Nov 9, 2022. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion twitter-native-video-player-icon.svg
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
    2 changes: 1 addition & 1 deletion twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    // @match https://twitter.com/*
    // @match https://mobile.twitter.com/*
    // @grant none
    // @version 1.0.5
    // @version 1.0.6
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace the user-unfriendly Twitter video player with the browser's native video player. This allows you to: seek backward/forward with the left/right keyboard keys, change the volume with the up/down keyboard keys, switch to full screen with double-click of f key, access the video's contextual menu, change the playback speed with the <kbd>+</kbd>, <kbd>-</kbd> and <kbd>0</kbd> keys or via the contextual menu, share the playback speed between videos.
  9. yukulele revised this gist Nov 9, 2022. 2 changed files with 11 additions and 1 deletion.
    9 changes: 9 additions & 0 deletions twitter-native-video-player-icon.svg
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
    3 changes: 2 additions & 1 deletion twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -4,10 +4,11 @@
    // @match https://twitter.com/*
    // @match https://mobile.twitter.com/*
    // @grant none
    // @version 1.0.4
    // @version 1.0.5
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace the user-unfriendly Twitter video player with the browser's native video player. This allows you to: seek backward/forward with the left/right keyboard keys, change the volume with the up/down keyboard keys, switch to full screen with double-click of f key, access the video's contextual menu, change the playback speed with the <kbd>+</kbd>, <kbd>-</kbd> and <kbd>0</kbd> keys or via the contextual menu, share the playback speed between videos.
    // @icon https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player-icon.svg
    // @downloadURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @updateURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @supportURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a#comments
  10. yukulele revised this gist Sep 30, 2022. 2 changed files with 19 additions and 14 deletions.
    8 changes: 4 additions & 4 deletions Twitter native video player.md
    Original file line number Diff line number Diff line change
    @@ -3,11 +3,11 @@
    Replace the user-unfriendly Twitter video player with the browser's native video player.

    This allows you to:
    * seek with <kbd title="left">←</kbd>/<kbd title="right">→</kbd> keys
    * change the volume with the <kbd title="top">↑</kbd>/<kbd title="bottom">↓</kbd> keys
    * Switch full screen with double-click or <kbd>f</kbd> key
    * seek backward/forward with the <kbd title="left">←</kbd> / <kbd title="right">→</kbd> keys
    * change the volume with the <kbd title="top">↑</kbd> / <kbd title="bottom">↓</kbd> keys
    * switch full screen with double-click or <kbd>f</kbd> key
    * access the video's contextual menu
    * change the playback speed (via the contextual menu)
    * change the playback speed with the <kbd>+</kbd> / <kbd>-</kbd> and <kbd>0</kbd> keys or via the contextual menu
    * share the playback speed between videos

    install: https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    25 changes: 15 additions & 10 deletions twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -4,42 +4,47 @@
    // @match https://twitter.com/*
    // @match https://mobile.twitter.com/*
    // @grant none
    // @version 1.0.3
    // @version 1.0.4
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace the user-unfriendly Twitter video player with the browser's native video player. This allows you to: seek with left/right keyboard keys, change the volume with the up/down keyboard keys, Switch to full screen with double-click of f key, access the video's contextual menu, change the playback speed (via the contextual menu), share the playback speed between videos.
    // @description Replace the user-unfriendly Twitter video player with the browser's native video player. This allows you to: seek backward/forward with the left/right keyboard keys, change the volume with the up/down keyboard keys, switch to full screen with double-click of f key, access the video's contextual menu, change the playback speed with the <kbd>+</kbd>, <kbd>-</kbd> and <kbd>0</kbd> keys or via the contextual menu, share the playback speed between videos.
    // @downloadURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @updateURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @supportURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a#comments
    // @inject-into auto
    // ==/UserScript==

    function nativePlayer(video) {
    video.playbackRate = window.localStorage.playbackRate || 1
    video.addEventListener('ratechange', () => window.localStorage.playbackRate = video.playbackRate)
    video.playbackRate = localStorage.playbackRate || 1
    video.addEventListener('ratechange', () => localStorage.playbackRate = video.playbackRate)
    video.addEventListener('mouseenter', () => video.controls = true)
    video.addEventListener('mouseleave', () => video.controls = false)
    video.addEventListener('keydown', e => e.key === 'f' && toggleFullscreen(video))
    video.addEventListener('keydown', e => keyboard(e.key, video))
    video.style.zIndex = 1
    video.focus()
    }

    function toggleFullscreen(video) {
    if(document.fullscreenElement) return document.exitFullscreen()
    if (document.fullscreenElement) return document.exitFullscreen()
    video.requestFullscreen()
    }

    const mutationObserver = new MutationObserver(mutationsList => {
    function keyboard(key, video) {
    if (key === 'f') return toggleFullscreen(video)
    if (key === '0') return video.playbackRate = 1
    if (key === '+') return video.playbackRate += 0.05
    if (key === '-') return video.playbackRate -= 0.05
    }

    new MutationObserver(mutationsList => {
    for (var mutation of mutationsList) {
    if (mutation.type !== 'childList') continue
    for (const node of mutation.addedNodes) {
    if (!(node instanceof HTMLElement)) continue
    for (const video of node.querySelectorAll('video')) nativePlayer(video)
    }
    }
    })

    mutationObserver.observe(document.documentElement, {
    }).observe(document.documentElement, {
    childList: true,
    subtree: true,
    })
  11. yukulele revised this gist Sep 28, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    // @match https://twitter.com/*
    // @match https://mobile.twitter.com/*
    // @grant none
    // @version 1.0.2
    // @version 1.0.3
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace the user-unfriendly Twitter video player with the browser's native video player. This allows you to: seek with left/right keyboard keys, change the volume with the up/down keyboard keys, Switch to full screen with double-click of f key, access the video's contextual menu, change the playback speed (via the contextual menu), share the playback speed between videos.
  12. yukulele revised this gist Sep 28, 2022. 2 changed files with 16 additions and 9 deletions.
    8 changes: 4 additions & 4 deletions Twitter native video player.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,11 @@
    # Twitter native video player

    Replace the user-unfriendly Twitter reader with the browser's native reader.
    Replace the user-unfriendly Twitter video player with the browser's native video player.

    This allows you to:
    * move the player with the left/right keyboard keys
    * change the volume with the up/down keyboard keys
    * Switch to full screen with double-click
    * seek with <kbd title="left">←</kbd>/<kbd title="right">→</kbd> keys
    * change the volume with the <kbd title="top">↑</kbd>/<kbd title="bottom">↓</kbd> keys
    * Switch full screen with double-click or <kbd>f</kbd> key
    * access the video's contextual menu
    * change the playback speed (via the contextual menu)
    * share the playback speed between videos
    17 changes: 12 additions & 5 deletions twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@
    // @version 1.0.2
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace the user-unfriendly Twitter reader with the browser's native reader. This allows you to: move the player with the left/right keyboard keys , change the volume with the up/down keyboard keys, Switch to full screen with double-click, access the video's contextual menu, change the playback speed (via the contextual menu), share the playback speed between videos
    // @description Replace the user-unfriendly Twitter video player with the browser's native video player. This allows you to: seek with left/right keyboard keys, change the volume with the up/down keyboard keys, Switch to full screen with double-click of f key, access the video's contextual menu, change the playback speed (via the contextual menu), share the playback speed between videos.
    // @downloadURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @updateURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @supportURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a#comments
    @@ -19,20 +19,27 @@ function nativePlayer(video) {
    video.addEventListener('ratechange', () => window.localStorage.playbackRate = video.playbackRate)
    video.addEventListener('mouseenter', () => video.controls = true)
    video.addEventListener('mouseleave', () => video.controls = false)
    video.addEventListener('keydown', e => e.key === 'f' && toggleFullscreen(video))
    video.style.zIndex = 1
    video.focus()
    }

    function toggleFullscreen(video) {
    if(document.fullscreenElement) return document.exitFullscreen()
    video.requestFullscreen()
    }

    const mutationObserver = new MutationObserver(mutationsList => {
    for (var mutation of mutationsList) {
    if (mutation.type !== 'childList') return
    if (mutation.type !== 'childList') continue
    for (const node of mutation.addedNodes) {
    if (!(node instanceof HTMLElement)) continue
    for (const video of node.querySelectorAll('video')) nativePlayer(video)
    }
    }
    })

    mutationObserver.observe(document.documentElement, {
    childList: true,
    mutationObserver.observe(document.documentElement, {
    childList: true,
    subtree: true,
    })
    })
  13. yukulele revised this gist Jun 26, 2022. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,9 @@
    // @name Twitter native video player
    // @namespace https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @match https://twitter.com/*
    // @match https://mobile.twitter.com/*
    // @grant none
    // @version 1.0.1
    // @version 1.0.2
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace the user-unfriendly Twitter reader with the browser's native reader. This allows you to: move the player with the left/right keyboard keys , change the volume with the up/down keyboard keys, Switch to full screen with double-click, access the video's contextual menu, change the playback speed (via the contextual menu), share the playback speed between videos
  14. yukulele revised this gist Jun 24, 2022. 2 changed files with 9 additions and 9 deletions.
    16 changes: 8 additions & 8 deletions Twitter native video player.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    # Twitter native video player

    Replace not user-friendly Twitter player with native browser player.
    Replace the user-unfriendly Twitter reader with the browser's native reader.

    This allow to:
    * seek with left/right keyboard keys
    * change volume with up/down keyboard keys
    * toggle fullscreen with double-click
    * access to video context menu
    * change playback rate (via context menu)
    * share playback rate between videos
    This allows you to:
    * move the player with the left/right keyboard keys
    * change the volume with the up/down keyboard keys
    * Switch to full screen with double-click
    * access the video's contextual menu
    * change the playback speed (via the contextual menu)
    * share the playback speed between videos

    install: https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    2 changes: 1 addition & 1 deletion twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    // @version 1.0.1
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace not user-friendly twitter player with native browser player. This allow to: seek with left/right keyboard keys change volume with up/down keyboard keys, fullscreen with double-click, change playback rate (via context menu), share playback rate between videos.
    // @description Replace the user-unfriendly Twitter reader with the browser's native reader. This allows you to: move the player with the left/right keyboard keys , change the volume with the up/down keyboard keys, Switch to full screen with double-click, access the video's contextual menu, change the playback speed (via the contextual menu), share the playback speed between videos
    // @downloadURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @updateURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @supportURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a#comments
  15. yukulele revised this gist Jun 24, 2022. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,9 @@
    // @namespace https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @match https://twitter.com/*
    // @grant none
    // @version 1.0
    // @version 1.0.1
    // @author yukulele
    // @homepage https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @description Replace not user-friendly twitter player with native browser player. This allow to: seek with left/right keyboard keys change volume with up/down keyboard keys, fullscreen with double-click, change playback rate (via context menu), share playback rate between videos.
    // @downloadURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @updateURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
  16. yukulele revised this gist Jun 22, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Twitter native video player.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Twitter native video player

    Replace not user-friendly Twitter :twitter: player with native browser player.
    Replace not user-friendly Twitter player with native browser player.

    This allow to:
    * seek with left/right keyboard keys
  17. yukulele revised this gist Jun 22, 2022. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions Twitter native video player.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,13 @@
    # Twitter native video player

    Replace not user-friendly twitter player with native browser player.
    Replace not user-friendly Twitter :twitter: player with native browser player.

    This allow to:
    * seek with left/right keyboard keys change volume with up/down keyboard keys
    * fullscreen with double-click
    * seek with left/right keyboard keys
    * change volume with up/down keyboard keys
    * toggle fullscreen with double-click
    * access to video context menu
    * change playback rate (via context menu)
    * share playback rate between videos.
    * share playback rate between videos

    install: https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
  18. yukulele renamed this gist Jun 22, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  19. yukulele revised this gist Jun 22, 2022. 2 changed files with 4 additions and 4 deletions.
    4 changes: 2 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # twitter native video player
    # Twitter native video player

    replace not user-friendly twitter player with native browser player.
    Replace not user-friendly twitter player with native browser player.

    This allow to:
    * seek with left/right keyboard keys change volume with up/down keyboard keys
    4 changes: 2 additions & 2 deletions twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,11 @@
    // ==UserScript==
    // @name twitter native video player
    // @name Twitter native video player
    // @namespace https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @match https://twitter.com/*
    // @grant none
    // @version 1.0
    // @author yukulele
    // @description replace not user-friendly twitter player with native browser player. This allow to: seek with left/right keyboard keys change volume with up/down keyboard keys, fullscreen with double-click, change playback rate (via context menu), share playback rate between videos.
    // @description Replace not user-friendly twitter player with native browser player. This allow to: seek with left/right keyboard keys change volume with up/down keyboard keys, fullscreen with double-click, change playback rate (via context menu), share playback rate between videos.
    // @downloadURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @updateURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @supportURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a#comments
  20. yukulele revised this gist Jun 22, 2022. No changes.
  21. yukulele revised this gist Jun 22, 2022. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # twitter native video player

    replace not user-friendly twitter player with native browser player.

    This allow to:
    * seek with left/right keyboard keys change volume with up/down keyboard keys
    * fullscreen with double-click
    * change playback rate (via context menu)
    * share playback rate between videos.

    install: https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
  22. yukulele revised this gist Jun 22, 2022. No changes.
  23. yukulele revised this gist Jun 22, 2022. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,14 @@
    // ==UserScript==
    // @name twitter native video player
    // @namespace https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a
    // @match https://twitter.com/*
    // @grant none
    // @version 1.0
    // @author yukulele
    // @description replace not user-friendly twitter player with native browser player. This allow to: seek with left/right keyboard keys change volume with up/down keyboard keys, fullscreen with double-click, change playback rate (via context menu), share playback rate between videos.
    // @downloadURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @updateURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a/raw/twitter-native-video-player.user.js
    // @supportURL https://gist.github.com/yukulele/805c382f371852e8f25efd7b2ec5876a#comments
    // @inject-into auto
    // ==/UserScript==

  24. yukulele created this gist Jun 22, 2022.
    32 changes: 32 additions & 0 deletions twitter-native-video-player.user.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    // ==UserScript==
    // @name twitter native video player
    // @match https://twitter.com/*
    // @grant none
    // @version 1.0
    // @author yukulele
    // @description replace not user-friendly twitter player with native browser player. This allow to: seek with left/right keyboard keys change volume with up/down keyboard keys, fullscreen with double-click, change playback rate (via context menu), share playback rate between videos.
    // @inject-into auto
    // ==/UserScript==

    function nativePlayer(video) {
    video.playbackRate = window.localStorage.playbackRate || 1
    video.addEventListener('ratechange', () => window.localStorage.playbackRate = video.playbackRate)
    video.addEventListener('mouseenter', () => video.controls = true)
    video.addEventListener('mouseleave', () => video.controls = false)
    video.style.zIndex = 1
    }

    const mutationObserver = new MutationObserver(mutationsList => {
    for (var mutation of mutationsList) {
    if (mutation.type !== 'childList') return
    for (const node of mutation.addedNodes) {
    if (!(node instanceof HTMLElement)) continue
    for (const video of node.querySelectorAll('video')) nativePlayer(video)
    }
    }
    })

    mutationObserver.observe(document.documentElement, {
    childList: true,
    subtree: true,
    })