i8beef / node-red-contrib-castv2

MIT License
22 stars 14 forks source link

User Error #5

Closed hav0ck closed 4 years ago

hav0ck commented 4 years ago

I was going to ask for help on how to send radio streams to the castv2 node.

I read the issue about the casting array and passing the info to msg.payload andnot just msg.

Can I make a suggestion to flush out an example a bit more to help those like me that are new to Node-Red.

It would be super helpful to mention that when using an inject node the payload: portion needs to be dropped.

So maybe something like:

Using an Inject Node: Make sure you set the payload type to JSON.

{
    type: "MEDIA",
    media: {
      url: "http://test.com/media.mp3",
      contentType: "audio/mp3", // optional if type can be infered from url file type
      streamType: "BUFFERED", // optional unless you want to send LIVE instead
      title: "Media title", // optional unless desired
      image: "http://test.com/media.png" // optional image to pass to cast device for icon, etc.
    }
  }

Thanks for the great node!

i8beef commented 4 years ago

Good suggestion. Ill change it.

i8beef commented 4 years ago

Actually, looking at the documentation I have here, I'm not sure whats unclear. I definitely don't want to get in the habit of documenting other nodes / node-red itself as part of this nodes documentation, and INJECT node usage kinda falls under that unbrella. I will add a note that clarifies a little bit that the message structure must match that exactly though to hopefully make it clear that passing on a MODIFIED message from an earlier step can cause issues though.

hav0ck commented 4 years ago

Like I said, definitely user error. I think it was a case of jumping in feet first without full/partial understanding of proper structure.

i8beef commented 4 years ago

If you're coming from the old cast node, its an easy mistake to make as they blurred the lines between msg and msg.payload in some ways that were confusing. I explicitly split payload to be the "command" being executed, and only have a few items in msg related to the "target" that your sending it to.