Hexer10 / youtube_explode_dart

Dart library to interact with many Youtube APIs
https://pub.dev/packages/youtube_explode_dart
BSD 3-Clause "New" or "Revised" License
299 stars 122 forks source link

When downloading larger videos, the program is prone to blocking the main thread, resulting in program unresponsiveness.[BUG] #263

Closed mlican closed 9 months ago

mlican commented 9 months ago

The program tends to freeze and become unresponsive when downloading videos that exceed a duration of 30 minutes.

Hexer10 commented 9 months ago

What the library does is just fetching data from the youtube servers, can you provide a code where I can reproduce the issue?

mlican commented 9 months ago

What the library does is just fetching data from the youtube servers, can you provide a code where I can reproduce the issue?

I apologize for my previous imprecise expression. When parsing closedCaptions of long-duration videos, the program experiences lag or crashes. The specific test code is as follows:

var yt = YoutubeExplode();  
String videoId = '5OdVJbNCSso';
var trackManifest = await yt.videos.closedCaptions  
    .getManifest(videoId);  
List<ClosedCaptionTrackInfo> trackInfoList =  
    trackManifest.tracks.toList();  
if (trackInfoList.isNotEmpty) {  
  ClosedCaptionTrack track = await yt  
      .videos.closedCaptions  
      .get(trackInfoList.first);  
  List<ClosedCaption> captions =  
      track.captions.toList();  
  print("captions.length:${captions.length}");  
}
yt.close();
Hexer10 commented 9 months ago

I just realeased a new version: 2.0.3, could you try updating and see if now it works?

mlican commented 9 months ago

I jsut realease a new version: 2.0.3, could you try updating and see if now it works? After updating to version 2.0.3, there is no longer an issue with thread blocking. It's fantastic. In the previous version, 2.0.2, I created a separate thread to parse closedCaptions. Although it didn't block the main thread, the processing speed was not as fast as in version 2.0.3. Now the problem is resolved. Thank you again!