Skip to content

Instantly share code, notes, and snippets.

@mkhahani
mkhahani / Inspecting Dropdown Menus
Last active December 16, 2023 20:03
Preventing Dropdown Menus from closing when Inspecting using Chrome Devtools
// Video: https://www.youtube.com/watch?v=jh8hUH_Zp0o
// in the Chrome console:
setTimeout(() => { debugger; }, 3000)
@mkhahani
mkhahani / ffmpeg.js
Last active November 6, 2023 19:15
Injecting audio/video stream into mediasoup using ffmpeg/gstreamer
// Class to handle child process used for running FFmpeg
const childProcess = require('child_process');
const Streamer = require('./streamer');
module.exports = class FFmpeg extends Streamer {
constructor(options) {
super(options);
this.time = options.time || '00:00:00.0'; // https://ffmpeg.org/ffmpeg-utils.html#time-duration-syntax
@mkhahani
mkhahani / app-bundle.js
Created February 4, 2020 07:00
Mediasoup sample app bundle v1.2.1
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict'
exports.byteLength = byteLength
exports.toByteArray = toByteArray
exports.fromByteArray = fromByteArray
var lookup = []
var revLookup = []
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
@mkhahani
mkhahani / waitFor.js
Last active July 3, 2019 05:36
JavaScript waitFor Promise based utility function
/**
* Waits specific amount of time for a function to fulfill
* @param {number} timeout
* @param {function} check
* @return {Promise<any>}
*/
waitFor: (timeout, check) => new Promise((resolve, reject) => {
const timer = setInterval(() => {
if (check()) {
clearInterval(timer);
/**
* Nuve client API
*
* @author aalonsog@dit.upm.es
* @author prodriguez@dit.upm.es
* @author jcervino@dit.upm.es
*/
const crypto = require('crypto');
const XHR = require('./xmlhttprequest');
{
"getUserMedia": [
{
"audio": "",
"origin": "https://www.skyroom.online",
"pid": 1228,
"rid": 806
}
],
"PeerConnections": {
2016-06-23 08:38:29.938 - INFO: AMQPER - Exchange rpcExchange is open
2016-06-23 08:38:29.941 - INFO: AMQPER - Exchange broadcastExchange is open
2016-06-23 08:38:29.944 - INFO: AMQPER - ClientQueue amq.gen-l9L-dIBxM4H_dSfYJLKhHA is open
2016-06-23 08:38:29.947 - INFO: ErizoJS - ID: ErizoJS_44d5ee1f-de8f-4a0e-d1da-ada701a9c878
2016-06-23 08:38:29.950 - INFO: AMQPER - Queue ErizoJS_44d5ee1f-de8f-4a0e-d1da-ada701a9c878 is open
2016-06-23 08:38:29.952 - INFO: ErizoJS - ErizoJS bound to amqp queue
2016-06-23 08:38:58.126 - INFO: ErizoJSController - Adding publisher peer_id 506651228759437800 minVideoBW 0 adaptation scheme undefined
2016-06-23 08:38:58,127 - DEBUG: OneToManyProcessor (/licode/erizo/src/erizo/OneToManyProcessor.cpp:12) - OneToManyProcessor constructor
2016-06-23 08:38:58,128 - DEBUG: Stats (/licode/erizo/src/erizo/Stats.cpp:16) - Constructor Stats
2016-06-23 08:38:58,128 - INFO: WebRtcConnection (/licode/erizo/src/erizo/WebRtcConnection.cpp:21) - WebRtcConnection constructor stunserver stu
@mkhahani
mkhahani / mainwindow.cpp
Created November 5, 2013 06:46
Add support for nickname to TT protocol
bool MainWindow::parseArgs(const QStringList& args)
{
...
AddLatestHost(entry);
Disconnect();
Connect();
QString nickname = ttSettings->value(SETTINGS_GENERAL_NICKNAME).toString();
if (nickname.isEmpty()) {
if (!entry.nickname.isNull()) {
@mkhahani
mkhahani / mainwindow.cpp
Last active December 27, 2015 10:59
Last working directory
void MainWindow::slotChannelsUploadFile(bool /*checked =false */)
{
int channelid = m_filesmodel->getChannelID();
if(channelid>0)
{
QString filename = QFileDialog::getOpenFileName(this, tr("Open File"),
ttSettings->value(SETTINGS_GENERAL_LAST_DIR, QDir::homePath()).toString()
/*, tr("All Files (*.*)")*/);
if (filename.isEmpty()) {
return;