Upgrade to Pro — share decks privately, control downloads, hide ads and more …

LINEで通話してくれる妹の作り方

uezo
December 16, 2021

 LINEで通話してくれる妹の作り方

LINE Developer Community 忘年LT大会での登壇資料。WebGLをLIFFで動かします。

uezo

December 16, 2021
Tweet

More Decks by uezo

Other Decks in Technology

Transcript

  1. Unity WebGL on LIFF Azure Speech Services ⚫ Unity WebGL

    LIFF ⚫ ⚫ ⚫ ⚫ Conversation Service FastAPI / Python Reminder Service (FastAPI / Python) VOICEROID Server ⚫ ⚫ ⚫ Push ⚫ ⚫ VOICEROID2 + pyvcroid2 FastAPI REST API Server LINE ⚫ Microphone WebGL Library ⚫ SALSA & Amplitude ⚫ ChatdollKit ⚫ Cygnet 3D
  2. WebGL 1. 5 10 2. dlopen, you need to use

    linking support, see https://github.com/kripken/emscripten 👉 3. C# async/await 👉 JS UniTask 4. .NET HttpClient 👉UnityWebRequest UniTask await 5. HTTP 👉Web CORS 6. Microphone 👉 Microphone WebGL Library 7. 👉 8. 16,000Hz 👉44100Hz 9. AudioClip.GetData() 👉Unity Wav 10. DownloadHandlerAudioClip.GetContent() 👉PCM AudioClip.Cleate() 11. MP3 TTS 👉 44,100Hz 20,050Hz 12. 👉 SALSA + Amplitude 13. UI 👉
  3. LIFF WebGL Tips Unity jslib JS LINE RequireLiffToken() sessionStorage ⚫

    LIFF Unity ⚫ Unity Web GL jslib ⚫ ⚫ init() iframe with liff.init() liff.getAccessToken() AccessToken setItem JS getItem AccessToken sendLiffToken() setLiffToken() & https://developers.line.biz/ja/docs/liff/opening-liff-app/#redirect-flow See also: LIFF URL LIFF
  4. LIFF WebGL Tips <script> window.liff = liff; window.sendLiffToken = function()

    { var liffToken = window.sessionStorage.getItem("LiffAccessToken"); unityInstance.SendMessage("Cygnet_MidiDress", "SetLiffToken", liffToken); } </script> Unity jslib using System.Runtime.InteropServices; using UnityEngine; public class LiffController : MonoBehaviour { [DllImport("__Internal")] private static extern void RequireLiffToken(); public string LiffAccessToken { private set; get; } private void Start() { // Request to HTML to call SetLiffToken RequireLiffToken(); } // HTML calls this method to pass the liff token public void SetLiffToken(string liffToken) { LiffAccessToken = liffToken; } } mergeInto(LibraryManager.library, { CloseLiffWindow: function () { window.liff.closeWindow(); }, RequireLiffToken: function () { window.sendLiffToken(); } }); JS