diff --git a/src/tracks/handle.rs b/src/tracks/handle.rs index c7387146d..d076c236a 100644 --- a/src/tracks/handle.rs +++ b/src/tracks/handle.rs @@ -24,8 +24,8 @@ pub struct TrackHandle { struct InnerHandle { command_channel: UnboundedSender, seekable: bool, - uuid: Uuid, metadata: Box, + uuid: Uuid, } impl TrackHandle { @@ -42,8 +42,8 @@ impl TrackHandle { let inner = Arc::new(InnerHandle { command_channel, seekable, - uuid, metadata, + uuid, }); Self { inner } diff --git a/src/tracks/mod.rs b/src/tracks/mod.rs index f72127bca..fe060ea7e 100644 --- a/src/tracks/mod.rs +++ b/src/tracks/mod.rs @@ -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());