Skip to content

Commit

Permalink
Remove stream versions tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bytedream committed May 22, 2024
1 parent 43613f4 commit f3d5931
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/media/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ impl Stream {
Ok(())
}

/// Show in which audios this [`Stream`] is also available.
pub fn available_versions(&self) -> Vec<Locale> {
self.versions
.clone()
Expand All @@ -183,6 +184,11 @@ impl Stream {
.collect()
}

/// Get the versions of this [`Stream`] which have the specified audio locale(s). Use
/// [`Stream::available_versions`] to see all supported locale.
/// This method might throw a too many active streams error. In this case, make sure to
/// have less/no active other [`Stream`]s open (through this crate or as stream in the browser
/// or app).
pub async fn version(&self, audio_locales: Vec<Locale>) -> Result<Vec<Stream>> {
let version_ids = self
.versions
Expand Down Expand Up @@ -227,6 +233,12 @@ impl Stream {
Ok(result)
}

/// Get all available other versions (same [`Stream`] but different audio locale) for this
/// [`Stream`].
/// This method might throw a too many active streams error. In this case, either make sure to
/// have less/no active other [`Stream`]s open (through this crate or as stream in the browser
/// or app), or try to use [`Stream::version`] to get only a specific version (requesting too
/// many [`Stream`]s at once will always result in said error).
pub async fn versions(&self) -> Result<Vec<Stream>> {
let version_ids = self
.versions
Expand Down
10 changes: 6 additions & 4 deletions tests/test_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ async fn process_segments_drm() {
}
}

#[tokio::test]
// will throw a too many active streams error
/*#[tokio::test]
async fn stream_versions_drm() {
assert_result!(STREAM_DRM.get().await.unwrap().versions().await)
}
}*/

#[tokio::test]
async fn stream_from_id_maybe_without_drm() {
Expand Down Expand Up @@ -136,7 +137,8 @@ async fn process_segments_maybe_without_drm() {
}
}

#[tokio::test]
// will throw a too many active streams error
/*#[tokio::test]
async fn stream_versions_maybe_without_drm() {
assert_result!(
STREAM_MAYBE_WITHOUT_DRM
Expand All @@ -146,7 +148,7 @@ async fn stream_versions_maybe_without_drm() {
.versions()
.await
)
}
}*/

#[tokio::test]
async fn stream_maybe_without_drm_is_really_drm_free() {
Expand Down

0 comments on commit f3d5931

Please sign in to comment.