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.

    [npm library] @bugsounet/cast

    Scheduled Pinned Locked Moved Development
    1 Posts 1 Posters 251 Views 1 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.
    • ? Offline
      A Former User
      last edited by

      @bugsounet/cast

      I created this library if you want to cast youtube in your module.
      This library is very simplified and ready for use in your node_helper.js

      This library is used in MMM-Assistant2Display

      single node routine for casting YouTube (or other ?) in webview tag

      Installation

      npm install @bugsounet/cast
      

      Sample with cast contructor

      const Cast = require("./index.js")
      
      this.config = {
        castName: "MagicMirror_Cast",
        port: 8569
      }
      
      var debug = true
      
      this.cast= new Cast(this.config.cast, callback, debug)
      this.cast.start()
      
      setTimeout(() => { this.cast.stop() } , 30 * 1000)
      
      function callback(noti, castLink) {
        if (noti == "CAST_START") console.log("Open this link:", castLink)
        if (noti == "CAST_STOP") console.log ("Cast End")
      }
      
      /** Note: Open the castLink in a webview tag **/
      /** needed useragent= "Mozilla/5.0 (SMART-TV; Linux; Tizen 2.4.0) AppleWebkit/538.1 (KHTML, like Gecko) SamsungBrowser/1.1 TV Safari/538.1" **/
      

      constructor of cast

      Cast(castConfig, callback, debug)

      castConfig {}
      • castName - Name of your device for reconize it in Cast apps
      • port - server port
      callback (notification, castlink)
      • CAST_START - return the url for start casting in a webview frame
      • CAST_STOP - return end of casting
      debug

      if you want debuging information, just set to true

      Functions

      • start() : start cast listener
      • stop() : force stop cast server

      Notes

      • Actually only YouTube works but may be other (in another update…)
      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • 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