BlackHole icon indicating copy to clipboard operation
BlackHole copied to clipboard

iOS Youtube playback issue

Open radughitescu opened this issue 2 years ago • 6 comments

Hi, i've noticed that only on iOS, in the youtube section sometimes the playback isn't working. Steps to reproduce: 1.Get latest version of blackhole 2.Run blackhole iOS app 3.Go to youtube section 4.Search for a song 5.Play each song in the results 6.Sometimes a song opens but doesn't play, it's stuck at 0:00 with no obvious error message

Has anyone encountered this ?

radughitescu avatar May 29 '22 17:05 radughitescu

I've found the issue. The problem occurs when the mime type in the url is webm, apparently audio_service or just_audio miss a codec on ios side or something of this sort. Any ideas on how to get only mp4 urls from youtube?

radughitescu avatar Jun 03 '22 14:06 radughitescu

You can filter out the urls. Each youtube video data contains a container type and codec type info. You can use them to check if it's m4a or webm.

shadow5688 avatar Jun 03 '22 15:06 shadow5688

Sorry I did not express myself correctly, i've figured out a way to filter out webm urls but i'm wondering if there's a way to get an mp4 alternative url from a webm url. Thanks for the reply!

radughitescu avatar Jun 03 '22 15:06 radughitescu

Every video has both m4a and webm URLs, and they are all available when you access the audio stream of those videos. I guess blackhole takes the top and lowest quality URLs from them. As for m4a and webm I think it prefers m4a, and if m4a isn't available, then it takes webm URLs. Or maybe it just checks bitrate; not sure I forgot; I will have to check the code.

shadow5688 avatar Jun 03 '22 16:06 shadow5688

Oooooh, great!!! Thanks! I'll look it up, if i manage to fix it i can do a pull request so that everyone will have the fix.

radughitescu avatar Jun 03 '22 16:06 radughitescu

Sure, the code will most probably in youtube_services.dart file. You can look it up in that where it extracts those audio links.

shadow5688 avatar Jun 03 '22 16:06 shadow5688