Class UnityMusicPlayerGateway
Unity-specific implementation of music player gateway for managing multiple music player services.
Provides interface adapter layer between application use cases and Unity music player service infrastructure.
Manages service lookup and routing of music player operations to the appropriate service instances.
Currently implements pause functionality with placeholder implementations for other music control operations.
Implements
Inherited Members
Namespace: Serenity.MusicPlayer.InterfaceAdapters.Gateways
Assembly: Serenity.UnityMusicPlayer.InterfaceAdapters.dll
Syntax
public class UnityMusicPlayerGateway : IMusicPlayerGateway
Constructors
UnityMusicPlayerGateway(Dictionary<string, IMusicPlayerService>)
Initializes a new instance of UnityMusicPlayerGateway with a collection of music player services.
Sets up the service dictionary for music player service management and routing.
Enables multi-service support for different music contexts within the application.
Declaration
public UnityMusicPlayerGateway(Dictionary<string, IMusicPlayerService> services)
Parameters
| Type | Name | Description |
|---|---|---|
| Dictionary<string, IMusicPlayerService> | services | Dictionary of service IDs mapped to music player service instances. |
Fields
_services
Declaration
protected Dictionary<string, IMusicPlayerService> _services
Field Value
| Type | Description |
|---|---|
| Dictionary<string, IMusicPlayerService> | Dictionary mapping service IDs to their corresponding music player service instances. |
Methods
PauseSong(MusicPlayerPauseSongInput)
Pauses the currently playing song on the specified music player service.
Routes the pause command to the appropriate music player service based on the service ID.
Provides application-level pause functionality through the gateway interface.
Declaration
public void PauseSong(MusicPlayerPauseSongInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| MusicPlayerPauseSongInput | input | Input DTO containing the service ID for the music player to pause. |
PlayNextSong(MusicPlayerPlayNextSongInput)
Advances to the next song in the playlist on the specified music player service.
This method is currently not implemented and throws a NotImplementedException.
Declaration
public void PlayNextSong(MusicPlayerPlayNextSongInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| MusicPlayerPlayNextSongInput | input | Input DTO containing the service ID for the music player. |
Exceptions
| Type | Condition |
|---|---|
| NotImplementedException | This method is not yet implemented. |
PlayPreviousSong(MusicPlayerPlayPreviousSongInput)
Goes back to the previous song in the playlist on the specified music player service.
This method is currently not implemented and throws a NotImplementedException.
Declaration
public void PlayPreviousSong(MusicPlayerPlayPreviousSongInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| MusicPlayerPlayPreviousSongInput | input | Input DTO containing the service ID for the music player. |
Exceptions
| Type | Condition |
|---|---|
| NotImplementedException | This method is not yet implemented. |
PlaySong(MusicPlayerPlaySongInput)
Starts playing a song on the specified music player service, forwarding the configured transition strategy and duration so the service can fade or cut between the previous and the new track.
Declaration
public void PlaySong(MusicPlayerPlaySongInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| MusicPlayerPlaySongInput | input | Input DTO containing the service ID and transition configuration. |
PlaySongById(MusicPlayerPlaySongByIdInput)
Starts playing a song resolved by its track id on the specified music player service.
Routes the play-by-id command, loop flag and transition configuration to the appropriate service.
Declaration
public void PlaySongById(MusicPlayerPlaySongByIdInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| MusicPlayerPlaySongByIdInput | input | Input DTO containing the service ID, music track id, loop flag and transition configuration. |
ResumeSong(MusicPlayerResumeSongInput)
Resumes playback of a previously paused song on the specified music player service.
This method is currently not implemented and throws a NotImplementedException.
Declaration
public void ResumeSong(MusicPlayerResumeSongInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| MusicPlayerResumeSongInput | input | Input DTO containing the service ID for the music player to resume. |
Exceptions
| Type | Condition |
|---|---|
| NotImplementedException | This method is not yet implemented. |
StopSong(MusicPlayerStopSongInput)
Stops the currently playing song on the specified music player service.
This method is currently not implemented and throws a NotImplementedException.
Declaration
public void StopSong(MusicPlayerStopSongInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| MusicPlayerStopSongInput | input | Input DTO containing the service ID for the music player to stop. |
Exceptions
| Type | Condition |
|---|---|
| NotImplementedException | This method is not yet implemented. |