logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    object
    UnityMusicPlayerGateway
    Implements
    IMusicPlayerGateway
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    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 virtual 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.
    Routes the request to the appropriate music player service based on the service ID.

    Declaration
    public virtual void PlayNextSong(MusicPlayerPlayNextSongInput input)
    Parameters
    Type Name Description
    MusicPlayerPlayNextSongInput input

    Input DTO containing the service ID for the music player.

    PlayPreviousSong(MusicPlayerPlayPreviousSongInput)

    Goes back to the previous song in the playlist on the specified music player service.
    Routes the request to the appropriate music player service based on the service ID.

    Declaration
    public virtual void PlayPreviousSong(MusicPlayerPlayPreviousSongInput input)
    Parameters
    Type Name Description
    MusicPlayerPlayPreviousSongInput input

    Input DTO containing the service ID for the music player.

    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 virtual 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 virtual 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.
    Routes the request to the appropriate music player service based on the service ID.

    Declaration
    public virtual void ResumeSong(MusicPlayerResumeSongInput input)
    Parameters
    Type Name Description
    MusicPlayerResumeSongInput input

    Input DTO containing the service ID for the music player to resume.

    StopSong(MusicPlayerStopSongInput)

    Stops the currently playing song on the specified music player service.
    Routes the request to the appropriate music player service based on the service ID.

    Declaration
    public virtual void StopSong(MusicPlayerStopSongInput input)
    Parameters
    Type Name Description
    MusicPlayerStopSongInput input

    Input DTO containing the service ID for the music player to stop.

    Implements

    IMusicPlayerGateway
    In this article
    © 2026 Serenity. All Rights Reserved