// Copyright (c) Arlo Godfrey. All Rights Reserved.
// Licensed under the GNU Lesser General Public License, Version 3.0 with additional terms.
// See the LICENSE, LICENSE.LESSER and LICENSE.ADDITIONAL files in the project root for more information.
using System;
using System.Threading;
using System.Threading.Tasks;
namespace StrixMusic.Sdk.MediaPlayback
{
///
/// A simple media player that can play an audio track.
///
/// Only plays one track at a time, and can cache other tracks ahead of time.
public interface IAudioPlayerService : IAudioPlayerBase
{
///
/// Plays a track.
///
/// The source configuration for this track.
/// A cancellation token that may be used to cancel the ongoing task.
/// A representing the asynchronous operation.
Task Play(PlaybackItem sourceConfig, CancellationToken cancellationToken = default);
///
/// Preloads a track to be played later.
///
/// The track's source data.
/// A cancellation token that may be used to cancel the ongoing task.
/// A representing the asynchronous operation.
Task Preload(PlaybackItem sourceConfig, CancellationToken cancellationToken = default);
///
/// The currently playing media source.
///
public PlaybackItem? CurrentSource { get; set; }
///
/// Raised when is changed.
///
public event EventHandler? CurrentSourceChanged;
///
/// Raised when a quantum of data is processed.
///
public event EventHandler? QuantumProcessed;
}
}