Skip to content

Instantly share code, notes, and snippets.

@Venipa
Last active July 29, 2022 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Venipa/74a751f64699a9a1f25b8548d1615bd6 to your computer and use it in GitHub Desktop.
Save Venipa/74a751f64699a9a1f25b8548d1615bd6 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Twitter HTML5 Video
// @namespace https://venipa.net
// @version 0.1
// @description try to take over the world!
// @author Venipa
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @updateUrl https://gist.github.com/Venipa/74a751f64699a9a1f25b8548d1615bd6/raw/twitter-html5-player.user.js
// @grant unsafeWindow
// ==/UserScript==
/* jshint esversion: 6 */
(function() {
'use strict';
function checkVideo(video, play) {
if (!video.controls) video.controls = true;
if (video.style.zIndex == '') video.style.zIndex = '99';
if (video.volume == 1) video.volume = 0.1;
if (play) video.muted = false;
}
(function(video, check){
var fn = video.load;
video.load = function() {
if (this.hasAttribute("playsinline")) {
check(this, false);
}
return fn.apply(this, arguments);
};
})(unsafeWindow.HTMLVideoElement.prototype, checkVideo);
(function(video, check){
var fn = video.play;
video.play = function() {
if (this.hasAttribute("playsinline")) {
check(this, true);
}
return fn.apply(this, arguments);
};
})(unsafeWindow.HTMLVideoElement.prototype, checkVideo);
})();
@Venipa
Copy link
Author

Venipa commented Jul 29, 2022

Userscript: Script
Better Twitter Player:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment