MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Youtube Embed API

    Scheduled Pinned Locked Moved Development
    4 Posts 2 Posters 3.2k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      Stubbsy1994
      last edited by

      Hi, I’m fairly new to javascript and really don’t understand how the structure works.

      Is it possible to create a module which uses the Youtube embed API?
      https://developers.google.com/youtube/player_parameters

      Ultimately i would like to be able to use the remote control to send a notification to play a playlist (from a specified list) from a random point in shuffle mode, as well as being able to pause/play and maybe rewind/repeat he current song.

      Thanks,

      A 1 Reply Last reply Reply Quote 0
      • A Offline
        Anhalter42 @Stubbsy1994
        last edited by

        @Stubbsy1994 LMGTFY (or in this case: let me use search function of this forum for you): searching for “embed youtube” on this forum gives this thread. I guess this is what you need.

        1 Reply Last reply Reply Quote 0
        • S Offline
          Stubbsy1994
          last edited by

          I checked that module, it doesn’t use the youtube API, just a generic iFrame. So it cannot e.g. skip, next, volume, shuffle etc.

          A 1 Reply Last reply Reply Quote 0
          • A Offline
            Anhalter42 @Stubbsy1994
            last edited by Anhalter42

            @Stubbsy1994 The link you provided describes how to embed youtube API into HTML sites using iframe-Tags in two ways. It seems, the module shown in the thread above uses the first method (iframe with source http:// www.youtube. com/embed/VIDEO_ID?parameters). I guess, the pure JS method ultimatively also uses an iframe since its called IFrame Player API.

            As far as I can see, both have equal functionality. It’s not really documented, but it seems like you can call all the functions for the player-object listed here in the direct iframe approach (first method), too. See parameter enablejsapi=1. For example pause or seek-to (not verified for all functions!):

            $('#video1')[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
            $('#video1')[0].contentWindow.postMessage('{"event":"command","func":"seekTo","args":[20, true]}', '*');
            

            Compare sendCommand function in youtube.js of the module described in the thread above.

            So even though the module may not satisfy all your needs by now, maybe you can take it as a starting point to develop your own solution?!

            1 Reply Last reply Reply Quote 2
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy