Baseflow / Baseflow/XamarinMediaManager

Duration value is doubled (Special case on youtube streaming)

Open
#832 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
763
Forks
299
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug Report
Just tested MediaManager on playing youtube videos and it's great. I use another component called YoutubeExplode which I can query the media manifest using youtube id. The media manifest can extract the Video and Audio only URL which I pass to CrossMediaManager.Current.Play() to play. Video is ok but when playing audio only (MP4), value of duration is twice. I tested Xamarin iOS on iPhone, simulator and device.

### Expected behavior
Audio only should have same duration as Video.

### Reproduction steps
YoutubeClient client = new YoutubeClient(); // **YoutubeExplode client**

// You can use the youtube ids below
// jgyl_LBdcxo
// VbD_kBJc_gI
// iSLwVaebsJg
// 7m6_WcBYFIY

StreamManifest manifest = await client.Videos.Streams.GetManifestAsync ();
var muxed = manifest
.GetMuxedStreams()
.OrderByDescending(v => v.VideoResolution.Height)
.ToList()
.FirstOrDefault();

string videoUrl = muxed != null ? muxed.Url : "";

var audio = manifest
.GetAudioOnlyStreams()
.Where(a => a.Container.Name.ToUpper() == "MP4")
.OrderByDescending(a => a.Bitrate.BitsPerSecond)
.ToList()
.FirstOrDefault();

string audioUrl = audio != null ? audio.Url : "";

await CrossMediaManager.Current.Play(videoUrl); // **Duration value here is correct**
await CrossMediaManager.Current.Play(audioUrl); // **Duration value here is doubled/twice**

### Configuration
Xamarin latest
iOS, iPhone

**Version:** 1.x

**Platform:**
- [*] :iphone: iOS
- [ ] :robot: Android
- [ ] :checkered_flag: WPF
- [ ] :earth_americas: UWP
- [ ] :apple: MacOS
- [ ] :tv: tvOS
- [ ] :monkey: Xamarin.Forms

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue through CrossMediaManager.Current.Play with the supplied YouTube audio-only and muxed URLs on iOS. Compare the reported durations for the two streams and trace the platform playback path used by MediaManager. Done means audio-only MP4 playback reports the same duration as the corresponding video stream.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, ios
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.