init.onAppStatusChange - GiGAGenie-ServiceSDK/UserGuide GitHub Wiki

gigagenie.init.onAppStatusChange

API ์„ค๋ช…

์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด Pause ๋˜๊ฑฐ๋‚˜ Resume ๋  ๊ฒฝ์šฐ์— ์ด๋ฒคํŠธ๋ฅผ ์•Œ๋ ค์ค€๋‹ค. Pause๋Š” ์‚ฌ์šฉ์ž๊ฐ€ โ€œ๊ธฐ๊ฐ€์ง€๋‹ˆโ€ ๋“ฑ์œผ๋กœ Key Word Spotting์„ ํ•˜๊ฑฐ๋‚˜, ๋‹ค๋ฅธ Application(์˜ˆ: ๊ฒฐ์žฌ ์š”์ฒญ)์„ ํ˜ธ์ถœํ•˜๊ฒŒ ๋˜๋ฉด Pause ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค. ์ดํ›„ ๋‹ค์‹œ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์‹คํ–‰๋˜๋Š” ์ƒํ™ฉ์ด ๋˜๋ฉด Resume ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค. Pause ์‹œ์— TTS, ๋™์˜์ƒ ํ”Œ๋ ˆ์ด ๋“ฑ์ด ์ค‘์ง€๋˜๋ฏ€๋กœ Resume ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›์•„์„œ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์‹คํ–‰์„ ๋ณต๊ตฌํ•ด์•ผ ํ•œ๋‹ค.

API ๊ตฌ์กฐ

  • gigagenie.init.onAppStatusChange ์ฝœ๋ฐฑ ๊ตฌํ˜„

  • ์ฝœ๋ฐฑ์€ function callback(extra) ๋กœ ๊ตฌํ˜„ํ•ด์•ผ ํ•˜๋ฉฐ extra ๋Š” ๋‹ค์Œ์˜ int ๊ฐ’์ด ์ „๋‹ฌ๋œ๋‹ค.

    • extra.changeStatus : Number, Mandatory๋กœ ๋‹ค์Œ์˜ ๊ฐ’์„ ๊ฐ€์ง„๋‹ค.
      • extra.changeStatus=0: Resume ์ƒํƒœ ์ง„์ž…
      • extra.changeStatus=1: Pause ์ƒํƒœ ์ง„์ž…
    • extra.muteFlag: Number, Mandatory๋กœ ๋‹ค์Œ์˜ ๊ฐ’์„ ๊ฐ€์ง„๋‹ค.
      • extra.muteFlag=false: unmute ์ƒํƒœ (์Œ์•…๋“ฑ ์žฌ์ƒ ๊ฐ€๋Šฅ)
      • extra.muteFlag=true: mute ์ƒํƒœ (์Œ์•… ๋“ฑ ์žฌ์ƒ ๋ถˆ๊ฐ€)
  • ์ฐธ๊ณ  ์ž๋ฃŒ: Mute/Unmute, App Pause/Resume Event ๊ด€๋ จ

์‚ฌ์šฉ ์˜ˆ์‹œ

gigagenie.init.onAppStatusChange = function (extra) {
    console.log(`onAppStatusChange: status=${extra.changeStatus}, mute=${extra.muteFlag}`);
    if (extra.changeStatus == 0) {
        if (extra.muteFlag == true) {
            // TODO: ์ผ๋ฐ˜์ ์œผ๋กœ ์„œ๋น„์Šค ์ข…๋ฃŒ ๊ถŒ๊ณ 
            gigagenie.voice.svcFinished(null, function (result_cd, result_msg) {
                console.log(`Function svcFinished : ${result_cd}, ${result_msg}`);
            });
            return;
        } else {
            // TODO: Media Contents Resume
        }
    } else {
        // TODO: Media Contents Pause
    }
}