This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jw = jwplayer('jwplayer').setup({file:"videofile.mp4"}); | |
var noop = function() {/* do nothing */} | |
var timeDelegate = noop; | |
jw.onTime(timeDelegate); | |
jw.onPlaylistItem(function(itemEvent) { | |
if (itemEvent.index === 1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// audio-levels.js | |
// https://github.com/bgrins/devtools-snippets | |
// Print out audio levels for all video / audio elements on the page. | |
// Watch out for: "MediaElementAudioSource outputs zeroes due to CORS access restrictions" ...for x-origin media urls | |
(function() { | |
[].forEach.call(document.querySelectorAll("video,audio"), function(media) { | |
var splitPath = media.src.split('/'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mkdir -p variant_source | |
ffmpeg -y -i tearsofsteel_4k.mov -vcodec libx264 -preset veryfast -crf 18 -profile:v baseline -s 480x212 -aspect 9/4 -acodec aac -strict experimental -ac 2 -b:a 96k -ar 44100 -bufsize 360K -maxrate 360K variant_source/ld.mp4 | |
ffmpeg -y -i tearsofsteel_4k.mov -vcodec libx264 -preset veryfast -crf 18 -profile:v main -s 640x288 -aspect 9/4 -an -bufsize 720K -maxrate 720K variant_source/sd.mp4 | |
ffmpeg -y -i tearsofsteel_4k.mov -vcodec libx264 -preset veryfast -crf 18 -profile:v high -s 1280x572 -aspect 9/4 -an -bufsize 2400K -maxrate 2400K variant_source/hd.mp4 | |
ffmpeg -y -i tearsofsteel_4k.mov -vcodec libx264 -preset veryfast -crf 18 -profile:v high -s 1920x856 -aspect 9/4 -an -bufsize 3200K -maxrate 3200K variant_source/fullhd.mp4 | |
ffmpeg -y -i tearsofsteel_4k.mov -vcodec libx264 -preset veryfast -crf 18 -profile:v high -s 2560x1142 -aspect 9/4 -an -bufsize 4800K -maxrate 4800K variant_source/quadhd.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var RollingSpider = require('rolling-spider'); | |
//discover.js | |
var drone = new RollingSpider({ | |
// uuid: ['RS_W179234'], | |
logger: console.log | |
// forceConnect: true | |
}); | |
console.log('drone', drone); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This script extends jwplayer api instances with a `_history` | |
property which is a hash of event types including "all". | |
After including this on the page, to check if a "play" event fired, | |
call `jwplayer()._history.play`. Initially this returns `undefined`. | |
Once the event is fired an array is populated with an object for each | |
event fired. | |
The `jwplayer()._history.all` array will always be present and contains |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Buffering</title> | |
<style> | |
.ranges { | |
height: 20px; | |
position: relative; | |
width: 400px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mediaElement = document.createElement('video'); | |
function toString(video) { | |
return ((video.parentNode ? ('<' + video.parentNode.nodeName + '>') : '') + '<' + video.nodeName + '>') | |
.toLowerCase(); | |
} | |
function videoEventHandler(e) { | |
console.warn(toString(e.target) + ' >> "' + e.type + '"'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(jwplayer) { | |
var utils = jwplayer.utils; | |
var _ = jwplayer._; | |
var TIMEOUT_MS = 25; | |
var TIMEOUT_SEC = TIMEOUT_MS/1000; | |
var TIMER = 'timer'; | |
function formatTime(t) { | |
t *= 1000; // seconds to milliseconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(jwplayer) { | |
const container = jwplayer().getContainer(); | |
const elements = Array.prototype.slice.call(container.querySelectorAll('*')) | |
.filter(element => element.tagName !== 'path'); | |
elements.unshift(container); | |
const listeners = elements.reduce((accumulator, element) => { | |
const listenersObj = getEventListeners(element); | |
return accumulator.concat(Object.keys(listenersObj).reduce((accumulator2, name) => { | |
listenersObj[name].forEach(eventListener => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (video) { | |
function toString() { | |
return ((video.parentNode ? ('<' + video.parentNode.nodeName + '>') : '') + '<' + video.nodeName + '>') | |
.toLowerCase(); | |
} | |
function videoEventHandler(e) { | |
console.warn(toString() + ' >> "' + e.type + '"'); | |
} | |
const MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; | |
if (MutationObserver) { |