Anonym-tsk / MMM-YouTube

MagicMirror module for youtube player with runtime configuration and controllable by notification.
MIT License
14 stars 4 forks source link

유튜브재생관련 문의 #3

Closed sangwoo-ryu closed 4 years ago

sangwoo-ryu commented 4 years ago

로그만 봤을때는 MMM-AssistantMk2도 유튜브 모듈에 정상적으로 신호 넘겨주고 유튜브도 정상적으로 재생 하게 하지만 npm start dev로 원인을 찾아보니까 widget api 에러가 뜹니다. 자세한 로그는 라즈베리에서 올려 드리겠습니다.

sangwoo-ryu commented 4 years ago

www-widgetapi.js:148 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('http://localhost:8080'). 위의 오류 때문에 유튜브 모듈이 실행되지 않는 것 같습니다.

sangwoo-ryu commented 4 years ago

로그 메세지

16:35:18.234] [LOG] Starting MagicMirror: v2.10.1 [16:35:18.241] [LOG] Loading config ... [16:35:18.245] [LOG] Loading module helpers ... [16:35:18.247] [LOG] No helper found for module: alert. [16:35:18.285] [LOG] Initializing new module helper ... [16:35:18.286] [LOG] Module helper loaded: updatenotification [16:35:18.286] [LOG] No helper found for module: clock. [16:35:18.623] [LOG] Initializing new module helper ... [16:35:18.624] [LOG] Module helper loaded: calendar [16:35:19.415] [LOG] Initializing new module helper ... [16:35:19.416] [LOG] Module helper loaded: MMM-AssistantMk2 [16:35:19.573] [LOG] Initializing new module helper ... [16:35:19.574] [LOG] Module helper loaded: MMM-Hotword [16:35:19.574] [LOG] No helper found for module: MMM-YouTube. [16:35:19.575] [LOG] All module helpers loaded. [16:35:19.576] [LOG] Starting server on port 8080 ... [16:35:19.589] [LOG] Server started ... [16:35:19.589] [LOG] Connecting socket for: updatenotification [16:35:19.590] [LOG] Connecting socket for: calendar [16:35:19.591] [LOG] Starting node helper for: calendar [16:35:19.591] [LOG] Connecting socket for: MMM-AssistantMk2 [16:35:19.592] [LOG] Connecting socket for: MMM-Hotword [16:35:19.593] [LOG] [HOTWORD] MMM-Hotword starts [16:35:19.593] [LOG] Sockets connected & modules started ... [16:35:19.689] [LOG] Launching application. [16:35:23.518] [LOG] Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/ltm0jrlsamv8mlhrg0bpcgu6ps%40group.calendar.google.com/public/basic.ics - Interval: 300000 [16:35:23.659] [LOG] [HOTWORD] Recipe is loaded: with-AMk2v3_smart-mirror.js [16:35:23.830] [LOG] [AMK2] MMM-AssistantMk2 Version: 3.1.0-3 [16:35:23.835] [LOG] [AMK2] RECIPE_LOADED: with-MMM-Hotword.js [16:35:23.849] [LOG] [AMK2] RECIPE_LOADED: with-MMM-Youtube.js [16:35:23.851] [LOG] [AMK2] NO_ACTION_TO_MANAGE [16:35:23.906] [LOG] [AMK2] Response delay is set to 0.5 second [16:35:23.913] [LOG] [AMK2] Use HTML5 for audio response [16:35:23.914] [LOG] [AMK2] AssistantMk2 is initialized. [16:35:24.035] [LOG] [AMK2] tmp directory is now cleaned. [16:35:24.260] [LOG] [HOTWORD] begins. [16:35:24.262] [LOG] [HOTWORD] Detector starts listening. [16:40:49.300] [LOG] [HOTWORD] Detected: SMARTMIRROR [16:40:50.392] [LOG] [HOTWORD] stops. [16:40:50.395] [LOG] [HOTWORD] After Recording is too short [16:40:50.396] [LOG] [HOTWORD] Final Result: { detected: true, hotword: 'SMARTMIRROR', file: null } [16:40:50.931] [LOG] [AMK2] QUERY: { type: 'MIC', profile: { profileFile: 'default.json', lang: 'ko-KR' }, key: null, lang: null, useScreenOutput: true, useAudioOutput: true, useHTML5: true, session: 1581493250410, status: 'standby', secretMode: false, sayMode: false } [16:40:51.007] [LOG] [AMK2:BM] MP3 FILE CREATING: /home/pi/MagicMirror/modules/MMM-AssistantMk2/tmp/lastResponse.mp3 [16:40:51.010] [LOG] [AMK2:AS] MIC:RECORDING START. [16:40:51.037] [LOG] [AMK2:16] START LISTENING 1 channels with sample rate 16000 [16:40:51.094] [LOG] [AMK2:16] Listening 44 bytes [16:40:51.180] [LOG] [AMK2:16] Listening 4000 bytes [16:40:51.305] [LOG] [AMK2:16] Listening 4000 bytes [16:40:51.430] [LOG] [AMK2:16] Listening 4000 bytes [16:40:51.555] [LOG] [AMK2:16] Listening 4000 bytes [16:40:51.680] [LOG] [AMK2:16] Listening 4000 bytes [16:40:51.805] [LOG] [AMK2:16] Listening 4000 bytes [16:40:51.883] [LOG] [AMK2:AS] CONVERSATION:RESPONSE [16:40:51.935] [LOG] [AMK2:16] Listening 4000 bytes [16:40:52.055] [LOG] [AMK2:16] Listening 4000 bytes [16:40:52.180] [LOG] [AMK2:16] Listening 4000 bytes [16:40:52.305] [LOG] [AMK2:16] Listening 4000 bytes [16:40:52.430] [LOG] [AMK2:16] Listening 4000 bytes [16:40:52.555] [LOG] [AMK2:16] Listening 4000 bytes [16:40:52.680] [LOG] [AMK2:16] Listening 4000 bytes [16:40:52.805] [LOG] [AMK2:16] Listening 4000 bytes [16:40:52.930] [LOG] [AMK2:16] Listening 4000 bytes [16:40:53.058] [LOG] [AMK2:16] Listening 4000 bytes [16:40:53.180] [LOG] [AMK2:16] Listening 4000 bytes [16:40:53.200] [LOG] [AMK2:AS] CONVERSATION:TRANSCRIPTION { transcription: '怨���, done: false } [16:40:53.305] [LOG] [AMK2:16] Listening 4000 bytes [16:40:53.430] [LOG] [AMK2:16] Listening 4000 bytes [16:40:53.553] [LOG] [AMK2:AS] CONVERSATION:TRANSCRIPTION { transcription: '怨���, done: false } [16:40:53.555] [LOG] [AMK2:16] Listening 4000 bytes [16:40:53.567] [LOG] [AMK2:AS] CONVERSATION:TRANSCRIPTION { transcription: '怨�����釉', done: false } [16:40:53.680] [LOG] [AMK2:16] Listening 4000 bytes [16:40:53.805] [LOG] [AMK2:16] Listening 4000 bytes [16:40:53.823] [LOG] [AMK2:AS] CONVERSATION:TRANSCRIPTION { transcription: '怨�����釉', done: false } [16:40:53.931] [LOG] [AMK2:16] Listening 4000 bytes [16:40:54.045] [LOG] [AMK2:AS] CONVERSATION:TRANSCRIPTION { transcription: '怨�����釉 �, done: false } [16:40:54.057] [LOG] [AMK2:16] Listening 4000 bytes [16:40:54.181] [LOG] [AMK2:16] Listening 4000 bytes [16:40:54.184] [LOG] [AMK2:AS] CONVERSATION:TRANSCRIPTION { transcription: '怨�����釉 �, done: false } [16:40:54.306] [LOG] [AMK2:16] Listening 4000 bytes [16:40:54.431] [LOG] [AMK2:16] Listening 4000 bytes [16:40:54.556] [LOG] [AMK2:16] Listening 4000 bytes [16:40:54.563] [LOG] [AMK2:AS] CONVERSATION:TRANSCRIPTION { transcription: '怨�����釉 �, done: false } [16:40:54.680] [LOG] [AMK2:AS] CONVERSATION:END_OF_UTTERANCE [16:40:54.681] [LOG] [AMK2:AS] MIC:RECORDING_END [16:40:54.682] [LOG] [AMK2:16] STOP LISTENING [16:40:54.684] [LOG] [AMK2:AS] CONVERSATION:TRANSCRIPTION { transcription: '怨�����釉 �, done: true } [16:40:54.772] [LOG] [AMK2:AS] CONVERSATION:SCREEN object [16:40:54.777] [LOG] [AMK2:AS] CONVERSATION:ACTION { requestId: '5e54cfcc-0000-2d02-827b-94eb2c1be55a' } [16:40:54.778] [LOG] [AMK2:AS] CONVERSATION:RESPONSE [16:40:54.781] [LOG] [AMK2:AS] CONVERSATION_ALL_RESPONSES_RECEIVED [16:40:54.782] [LOG] [AMK2:AS] CONVERSATION_END:COMPLETED [16:40:54.784] [LOG] [AMK2:AS] CONVERSATION_PP:RESPONSE_AUDIO_TOO_SHORT_OR_EMPTY - 0 [16:40:54.785] [LOG] [AMK2:BM] MP3 FILE CREATED [16:40:54.809] [LOG] [AMK2] { session: 1581493250410, error: null, action: { requestId: '5e54cfcc-0000-2d02-827b-94eb2c1be55a' }, text: null, screen: { help: [ '臾댁� � � 以 ��?' ], trysay: '�ㅼ怨� 媛��� 蹂댁 몄', links: [ 'https://m.youtube.com/watch?v=EmG4tPZZZ_0' ], text: '� � �怨���몄- �媛 ��23遺

eouia commented 4 years ago

www-widgetapi.js:148 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('http://localhost:8080'). 해당오류는 상관없을 겁니다. Youtube API 자체 오류메시지인데, 실행에 특별히 문제가 되지는 않습니다.

그보다는, 제가 해당 URL을 재생 시도 해봤더니; image

[YOUTUBE] Player Error: (150) Not Allowed By Owner

가 잡히네요. 이런 경우, 국가별 권한, 저작권이나 영상오너의 설정 등에 따라 해당 지역 등에서 Youtube 사이트 외에서의 재생이 막혀 있는 경우입니다.

sangwoo-ryu commented 4 years ago

config.js는 이렇게 되어있고

/ Magic Mirror Config Sample

var config = { address: "localhost", // Address to listen on, can be: // - "localhost", "127.0.0.1", "::1" to listen on loopback interface // - another specific IPv4/6 to listen on a specific interface // - "", "0.0.0.0", "::" to listen on any interface // Default, when address config is left out, is "localhost" port: 8080, ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses // or add a specific IPv4 of 192.168.1.5 : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],

language: "ko",
timeFormat: 24,
units: "metric",
// serverOnly:  true/false/"local" ,
             // local for armv6l processors, default 
             //   starts serveronly and then starts chrome browser
             // false, default for all  NON-armv6l devices
             // true, force serveronly mode, because you want to.. no UI on this device

modules: [
    {
        module: "alert",
    },
    {
        module: "updatenotification",
        position: "top_bar"
    },
    {
        module: "clock",
        position: "top_left"
    },
    {
        module: "calendar",
        header: "공휴일",
        position: "top_left",
        config: {
            calendars: [
                {
                    symbol: "calrendar",
                    url: "https://calendar.google.com/calendar/ical/ltm0jrlsamv8mlhrg0bpcgu6ps%40group.calendar.google.com/public/basic.ics"                    }
            ]
        }
    },
    {
        module: "MMM-AssistantMk2",
        position: "top_bar",
        config: {
            debug: true,
            ui: "Classic2",
            recipes: ["with-MMM-Hotword.js", "with-MMM-Youtube.js"],
            responseConfig: {
            useScreenOutput: true,
                },
            profiles: {
                "default": {
                    profileFile: "default.json",
                    lang: "ko-KR"
                    },
                },
            },

    },
    {
        module: "MMM-Hotword",
        position: "top_center",
        config: {
            useDisplay: false,
            recipes: ["with-AMk2v3_smart-mirror.js"],
            restart: false,
            }
    },
    {
        module: "MMM-YouTube",
        position: "middle_center",
        config: {
            defaultQuality: "default",
            showPlayingOnly: true,
            }

    },      
]

};

/ DO NOT EDIT THE LINE BELOW / if (typeof module !== "undefined") {module.exports = config;}

어떤 유튜브 영상을 실행하려 하든 매직미러에 유튜브 화면이 나타나질 않습니다.

eouia commented 4 years ago

config이나 모듈에는 특별히 잘못된 점은 없어 보이고, (150) 에러가 나오는 한, 전부 권한 문제라서요...

sangwoo-ryu commented 4 years ago

[17:34:10.670] [LOG] Sockets connected & modules started ... [17:34:10.775] [LOG] Whoops! There was an uncaught exception... [17:34:10.775] [ERROR] Error: listen EADDRINUSE: address already in use 127.0.0.1:8080 at Server.setupListenHandle [as _listen2] (net.js:1226:14) at listenInCluster (net.js:1274:12) at GetAddrInfoReqWrap.doListen [as callback] (net.js:1413:7) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:65:10) { code: 'EADDRINUSE', errno: 'EADDRINUSE', syscall: 'listen', address: '127.0.0.1', port: 8080 } [17:34:10.783] [LOG] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? [17:34:10.783] [LOG] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues

혹시 모듈문젠가 해서 유튜브 모듈의 showplayingonly 옵션을 false로 바꿨더니 위와같은로그가 뜨면서 매직미러가 멈춰 버리네요.

eouia commented 4 years ago

[ERROR] Error: listen EADDRINUSE: address already in use 127.0.0.1:8080 이건, 같은 포트로 2개 이상의 MagicMirror 인스턴스를 실행시키려고 하면 발생합니다. 즉 MM을 두번 실행시켰다는 뜻이라서 현재 이슈와는 상관없는 에러에요.

sangwoo-ryu commented 4 years ago

매직미러 하나가 백그라운드에서 종료되지않고 돌아가고 있어서 떳던 오류네요 모듈은 정상적으로 나타나는데 동영상재생은 안되네요.

sangwoo-ryu commented 4 years ago

지금까지 시도한것들 고양이, 스마일, 갑수목장, that's life, 개

sangwoo-ryu commented 4 years ago

이거 mmm-assistantmk2에 있는 레시피를 그냥 쓰면 해당 명령어를 유튜브에서 검색해서 재생해주는것 아닌가요?

eouia commented 4 years ago

조금 다릅니다. 기본 레시피는 일반적인 쿼리를 했을 때 Google Assistant 서버가 돌려주는 응답 중, Youtube 링크가 있을 때에 MMM-Youtube를 재생시키는 레시피입니다. Youtube 사이트에서 찾은 결과가 아니라, Google 검색에서 돌려주는 결과에 더 비슷할 겁니다. 특정 어구 검색을 위해서는 레시피를 직접 만드셔야 합니다. 사용자가 말한 검색어 획득을 위해서는 transcriptionHook나 action을 사용하시고, YOUTUBE_LOAD notification의 payload로 type:playlist, listType:search, id:검색어를 쓰시면 Youtube내에서 검색한 결과를 가지고 재생할 수 있습니다. https://github.com/eouia/MMM-YouTube#typeplaylist

sangwoo-ryu commented 4 years ago

transcription에서 패턴이 아니라 코맨드에 명령어 설정이 들어가있어서 재생이 안되는거였어요