Skip to content

Instantly share code, notes, and snippets.

@Venipa
Last active January 11, 2023 20:53
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/f9a91ba80d2f99297cc2bd7081cc87f6 to your computer and use it in GitHub Desktop.
Save Venipa/f9a91ba80d2f99297cc2bd7081cc87f6 to your computer and use it in GitHub Desktop.
Instagram - Brings HTML5 native player to top layer v2
// ==UserScript==
// @name Instagram HTML5 Video
// @namespace https://venipa.net
// @version 0.1
// @description try to take over the world!
// @author Venipa
// @match https://www.instagram.com/*
// @updateURL https://gist.github.com/Venipa/f9a91ba80d2f99297cc2bd7081cc87f6/raw/e98b7d9f29e91e7fe5aef14101380b9532a0df61/instagram-native-html5-player.user.js
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @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 = '9';
if (video.style.position == '') video.style.position = 'relative';
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(video, 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(video, arguments);
};
})(unsafeWindow.HTMLVideoElement.prototype, checkVideo);
})();
@Venipa
Copy link
Author

Venipa commented Sep 16, 2021

Watch videos without blasting ur ears:
image

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