Skip to content

Instantly share code, notes, and snippets.

View GiriAakula's full-sized avatar
💭
Coding!

GiriAakula

💭
Coding!
View GitHub Profile
@GiriAakula
GiriAakula / Videojs-Errors.md
Last active June 22, 2023 05:27
This gist will explain how to get error events from videojs player.

Videojs Player Errors

To handle errors in Videojs player, you can use the following code:

const errorCodes = ["MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED"];

playerInstance.on("error", function() {
  sendEvent("playerError", errorCodes[playerInstance.error().code]);
});
Paused after 2 secs of ad start
Resumed after 1 min
Ad break fucked up
----------------------------------
If the ad break comes in first 10 secs
@GiriAakula
GiriAakula / taptounmute_flowchart.md
Last active June 17, 2022 07:24
Tap To Unmute Flow chart - Vidgyor
if(tap === true)
  if(autoplay === true)
      if(mute === true)
        Video will play with taptounmute, with autoplay and with mute
        
        
if(tap === true)
  if(autoplay === true)
      if(mute === false)
@GiriAakula
GiriAakula / Vidgyor_Error_Types_Web_Video_Player.md
Last active June 2, 2022 14:12
Vidgyor_Error_Types_Web_Video_Player.md

Vidgyor Video Player - Error Types

Vidgyor player mainly emits six types of errors.

  1. MEDIA_ERR_CUSTOM
  2. MEDIA_ERR_ABORTED
  3. MEDIA_ERR_NETWORK
  4. MEDIA_ERR_DECODE
  5. MEDIA_ERR_SRC_NOT_SUPPORTED
  6. MEDIA_ERR_ENCRYPTED
@GiriAakula
GiriAakula / embed.php
Last active April 26, 2022 05:19
Vidgyor wordpress whitelist
In the server go to the wordpress path.. in most systems it is
/var/www/wordpress/wp-includes/embed.php
In the above file add this
wp_embed_register_handler( 'vidgyor', '#https://static\.vidgyor\.com/player/vod/html/(.+?)\.html\?videoId=(.+?)&cmsAccountId=(.+?)&masterProfileId=(.+?)($|&)#i', 'wp_embed_handler_vidgyor' );
function wp_embed_handler_vidgyor( $matches, $attr, $url, $rawattr ) {
@GiriAakula
GiriAakula / loopTable.js
Last active October 11, 2021 05:38
Loop through all the elements in the table and get particular text content in particular coloumn.
// This is for getting data from aws s3 bucket UI.
document.querySelector("something").children.forEach(child => console.log(child.children[1].textContent))
@GiriAakula
GiriAakula / rsa.js
Created September 24, 2021 06:00 — forked from sohamkamani/rsa.js
An example of RSA Encryption implemented in Node.js
const crypto = require("crypto")
// The `generateKeyPairSync` method accepts two arguments:
// 1. The type ok keys we want, which in this case is "rsa"
// 2. An object with the properties of the key
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", {
// The standard secure default length for RSA keys is 2048 bits
modulusLength: 2048,
})
@GiriAakula
GiriAakula / Vidgyor-Midroll-Integrations-Docs.md
Last active April 2, 2021 14:00
Vidgyor Midroll Integrations Docs

Vidgyor Midroll Plugin Docs

To integrate the midroll plugin to your existing videojs player follow the below steps.

Add CSS

<link rel="stylesheet" href="https://vgrplayer.s3.ap-south-1.amazonaws.com/midroll-test-player/vidgyor-vjs_v3.css">

Add Javascript

<script src="https://vgrplayer.s3.ap-south-1.amazonaws.com/midroll-player/ads.min.js"></script>