WebRTCでやれよ!と言われそうなところですが、 WebSocket+WebAudioの組み合わせで音声ストリーミングをシンプルに構成する方法を紹介してみます。
サーバーサイドは何でも良いのですが、
とりあえずNode.jsでtest.mp3というサンプルファイルをpcmモジュールでデコードし、
wsでクライアントに垂れ流す作りにしておきます。
| #!ruby | |
| # | |
| # THETAのシャッターをPCから遠隔で切るだけの例 by GOROman | |
| # | |
| # 参考にしたページ | |
| # http://mobilehackerz.jp/contents/Review/RICOH_THETA | |
| require 'socket' |
| 0: 異世界チート魔術師(マジシャン) | |
| [ファンタジー,R15,残酷な描写あり,ファンタジー,異世界トリップ,チート,完結が最大の目標,魔法,恋愛,強さのインフレ,テンプレ] | |
| 0: クロの戦記 | |
| [ファンタジー,R15,残酷な描写あり,ファンタジー,異世界,貴族,国家/民族,異世界召喚,エルフ,チート,ハーレム,ミノタウルス,奴隷,内政,魔術,蛮族] | |
| 0: オーバーロード:後編 | |
| [ファンタジー,R15,MMO,最強,異世界] | |
| 0: 二度目の人生を異世界で | |
| [ファンタジー,R15,残酷な描写あり,警告タグは保険,チート表現あり] | |
| 0: 勇者互助組合 交流型掲示板 | |
| [ファンタジー,勇者,多重世界,掲示板,勇者がいっぱい,だらだらおしゃべり,基本コメディ,時々シリアス?,あくまでも掲示板形式] |
| -- script.lua | |
| -- Receives a table, returns the sum of its components. | |
| io.write("The table the script received has:\n"); | |
| x = 0 | |
| for i = 1, #foo do | |
| print(i, foo[i]) | |
| x = x + foo[i] | |
| end | |
| io.write("Returning data back to C\n"); | |
| return x |
| /* | |
| Copyright (c) 2014-2020 Electronic Cats SAPI de CV. All right reserved. | |
| This library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Lesser General Public | |
| License as published by the Free Software Foundation; either | |
| version 2.1 of the License, or (at your option) any later version. | |
| This library is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| rem 1Kトーンを再生する | |
| ECHO OFF | |
| ffplay -f lavfi -i "sine=frequency=1000" |