Jump to content

C# Add a track to the current playing queue


Go to solution Solved by CharlieB,

Recommended Posts

Posted

Hi

I have a music track as a full filepath wrapped in JSON, that I want to add to the current playing music queue, to the end of the playlist.  

Can I just deserialise and gift the filepath to Emby and it add it, or do I need to do some kind of search to find an item id first based off the filepath?

ChatGPT suggested to use QueueTrackAsync but I don't see any reference to that anywhere!

Is there any c# sample code how to add a track?

Thanks in advance

Posted

Any ideas?  I thought it would be an easy answer but nobody know?? 😢

  • 2 weeks later...
Posted

Hi @CharlieBsee ISessionManager.SendPlayCommand

Please note, you can only send tracks that are already in the server database. You can't just send any arbitrary file path.

  • Solution
Posted

Awesome thank you.  😊  I figured it out after a lot of head scratching!

I've loaded my source code as a proof of concept on github on the link below;

https://gist.github.com/CaptainKarma/4e02b1a9965637f6fb7bc855c3a64d58

The example code covers the following workflows which maybe helpful for future developers based off the EmbySimplePlugin/Plugin.cs code stub

  // Emby C# Code Example
  // Get the current playing audio item from Emby as a filepath e.g. D:\Music\Artist\Blah.mp3
  // Wrapping into a JSON payload and sending externally
  // Receive a response and pull filepath
  // Pass the filepath that we want to play and grab the Emby internal media ID (before it can be queued)
  // Obtaining Emby Session ID to target the correct device
  // Send a play request to Emby, passing the mediaID and which device should play it
 
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...