Skip to content

Instantly share code, notes, and snippets.

@gtk2k
gtk2k / BinarySerializer_without_Blob.js
Last active August 6, 2020 15:07
Browser JS BinarySerializer without Blob (and without async/await)
// Know Isshue.
// recursive Object endless loop.
// const obj = {};
// obj.o = obj;
class BinarySerializer {
static supportTypes = [
undefined, null,
Number, BigInt,
String,
Boolean,
@gtk2k
gtk2k / BinarySerializer.js
Last active August 6, 2020 13:21
Browser JS BinarySerializer
// Know Isshue.
// recursive Object endless loop.
// const obj = {};
// obj.o = obj;
class BinarySerializer {
static supportTypes = [
undefined, null,
Number, BigInt,
String,
Boolean,
@gtk2k
gtk2k / wowzaapi.js
Created May 12, 2020 14:31
Wowza REST API JavaScript(Node.js)
import crypto from 'crypto';
import https from 'https';
export class WowzaAPI {
constructor(apiKey, accessKey) {
this.apiVersion = '1.4';
this.apiSignaturePath = '/api/v1.4';
this.apiKey = apiKey;
this.accessKey = accessKey;
}
@gtk2k
gtk2k / mid.html
Created May 7, 2020 10:42
transceiver mid
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
video {
width: 400px;
@gtk2k
gtk2k / gist:8dad9812ac82680831c4c73e48210548
Created February 25, 2020 04:54
GetUnityXRInputDevice.cs
public class XRTracker : MonoBehaviour
{
//Keep this around to avoid creating heap garbage
static List<InputDevice> devices = new List<InputDevice>();
[SerializeField]
InputDeviceRole role;
InputDevice trackedDevice;
void OnEnable()
{
InputDevices.deviceConnected += OnDeviceConnected;
@gtk2k
gtk2k / sesameapi.js
Last active July 8, 2019 11:22
スマートロック SESAME の APIを実行するクラス (Node.js用)
// 使用方法
// その1 deviceIdを指定せずにインスタンスを正セすることで、複数のデバイスをコントロール
// const sesame = new SesameAPI(apiKey);
// sesame.control('lock', deviceId);
// その2 特定のデバイス用にインスタンスを生成すれば、コントロール時にdeviceIdを省略可能
// const sesame = new SesameAPI(apiKey, deviceId);
// sesame.lock();
@gtk2k
gtk2k / youtube_itag.cs
Last active May 4, 2019 10:59
youtube itag
// code from https://tyrrrz.me/Blog/Reverse-engineering-YouTube
private static readonly Dictionary<int, ItagDescriptor> ItagMap = new Dictionary<int, ItagDescriptor>
{
// Muxed
{5, new ItagDescriptor(Container.Flv, AudioEncoding.Mp3, VideoEncoding.H263, VideoQuality.Low144)},
{6, new ItagDescriptor(Container.Flv, AudioEncoding.Mp3, VideoEncoding.H263, VideoQuality.Low240)},
{13, new ItagDescriptor(Container.Tgpp, AudioEncoding.Aac, VideoEncoding.Mp4V, VideoQuality.Low144)},
{17, new ItagDescriptor(Container.Tgpp, AudioEncoding.Aac, VideoEncoding.Mp4V, VideoQuality.Low144)},
{18, new ItagDescriptor(Container.Mp4, AudioEncoding.Aac, VideoEncoding.H264, VideoQuality.Medium360)},
{22, new ItagDescriptor(Container.Mp4, AudioEncoding.Aac, VideoEncoding.H264, VideoQuality.High720)},
@gtk2k
gtk2k / youtubeurl.cs
Last active October 22, 2019 07:02
Youtubeの動画URLを取得する(Live対応)
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@gtk2k
gtk2k / gist:04cb75da6a123025318aa2bea5200279
Created April 30, 2019 05:13
WebRTCのUnityプラグインのビルド方法
# リポジトリのクローン
[WonderMediaProductions/webrtc-build](https://github.com/WonderMediaProductions/webrtc-build)
のリポジトリをクローンする
# VS2017をインストール
VS2019でもビルドができたという報告が上がっているが、私の環境(Win10:Home Editionを再インストールした状態)だとダメだった。
バッチファイルの中を見てみると冒頭に
```
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
```
@gtk2k
gtk2k / gist:bcccfdb628daa519de59a30d25cf4491
Last active April 13, 2019 10:33
動画配信プロトコル

WebRTCも動画を配信できますが、今回はKDDIのソリューションに対する勉強会ということで、 KDDIが提示した構成図に「Liveshell X」という機材が使われるようです。 この機材は、手のひらサイズの配信機材で、これだけで(PCレス)でライブ配信ができるというもので、さらにバッテリーを搭載しており、 特に屋外やデスクトップ以外での配信に焦点を当てた機材となっています。 「Liveshell X」は

RTMP

RTMPはAdobeがFlashで使うために開発したプロトコルで、RTMPのプロトコルでの一番の特徴がプッシュ配信、 つまり、配信者が自由なタイミングで配信を開始でき、(また、仕様が公開されているので)特に放送主からサーバーにストリームを配信するのに使われており、 Youtube Live, ニコ生, Fresh Live, Twitch, Ustream など主要なライブ配信サービスで放送主からサーバーに配信するプロトコルとして採用されています。