Tracks: Allow custom UUID setting (#33)
This commit is contained in:
@@ -377,11 +377,19 @@ impl Track {
|
||||
///
|
||||
/// [`Track`]: Track
|
||||
/// [`TrackHandle`]: TrackHandle
|
||||
#[inline]
|
||||
pub fn create_player(source: Input) -> (Track, TrackHandle) {
|
||||
create_player_with_uuid(source, Uuid::new_v4())
|
||||
}
|
||||
|
||||
/// Refer to the documentation for [`create_player`] however, allows for a custom uuid to be inserted into the Track and Handle
|
||||
///
|
||||
/// [`create_player`]: create_player
|
||||
pub fn create_player_with_uuid(source: Input, uuid: Uuid) -> (Track, TrackHandle) {
|
||||
let (tx, rx) = mpsc::unbounded_channel();
|
||||
let can_seek = source.is_seekable();
|
||||
let metadata = source.metadata.clone();
|
||||
let handle = TrackHandle::new(tx, can_seek, Uuid::new_v4(), metadata);
|
||||
let handle = TrackHandle::new(tx, can_seek, uuid, metadata);
|
||||
|
||||
let player = Track::new_raw(source, rx, handle.clone());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user