facebook twitter hatena line email

「Unity/Agora/voicechat community/token取得」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(本番tokenをワンタイムtoken経由で取得する)
(本番tokenをワンタイムtoken経由で取得する)
行7: 行7:
 
==本番tokenをワンタイムtoken経由で取得する==
 
==本番tokenをワンタイムtoken経由で取得する==
 
#VideoCanvasのオブジェクトとかに、ClientTokenを検索してAddComponentする
 
#VideoCanvasのオブジェクトとかに、ClientTokenを検索してAddComponentする
#ServerURLを入れる。(ttp://localhost:8080/ な感じ。この場合ttp://localhost:8080/rte/testing/publisher/uid/1234/?3600にアクセスされる)
+
#ServerURLを入れる。(ttp://localhost:8080/ な感じ。この場合ttp://localhost:8080/rte/testing/publisher/uid/1234/?3600 にアクセスされる)
  
 
==useTokenをtrueにすることでエラーになる==
 
==useTokenをtrueにすることでエラーになる==

2022年12月10日 (土) 01:39時点における版

1日有効な本番token取得

  1. https://console.agora.io/ にアクセス
  2. stageをliveに
  3. Generate temp RTC tokenを選択して、チャンネル名を入れてtokenを取得
  4. サンプルのClientManagerTestシーンの、CanvasVideoのInspectorにあるuseTokenを、falseにして、token文字列を設置するとつながる

本番tokenをワンタイムtoken経由で取得する

  1. VideoCanvasのオブジェクトとかに、ClientTokenを検索してAddComponentする
  2. ServerURLを入れる。(ttp://localhost:8080/ な感じ。この場合ttp://localhost:8080/rte/testing/publisher/uid/1234/?3600 にアクセスされる)

useTokenをtrueにすることでエラーになる

ArgumentNullException: String reference not set to an instance of a String.
Parameter name: source

GetRtcToken()内の以下場所で、serverURLが、nullなので、エラーが出てるっぽい。

if (!serverURL.StartsWith("http"))

serverURLを入れる必要がありそう

   ///    The helper class gets the token from a server endpoint conformed to
   /// format like this:
   ///   http://localhost:8080/rte/testing/publisher/uid/1234/?3600
   /// See the GitHub project for compatible server code in GoLang:
   ///   https://github.com/AgoraIO-Community/agora-token-service

goのtokenを設定

https://github.com/AgoraIO-Community/agora-token-service

agora-token-service設定

$ git clone https://github.com/AgoraIO-Community/agora-token-service.git
$ cp .env.example .env

.envを設定

APP_ID=
APP_CERTIFICATE=
$ go run cmd/main.go