sealedtx / java-youtube-downloader

Simple, almost zero-dependency java parser for retrieving youtube video metadata
Other
413 stars 115 forks source link

I am trying to implemet Coroutines With this Library , Need Help #34

Closed Shabinder closed 4 years ago

Shabinder commented 4 years ago

how to make a call to function like: val video = ytDownloader?.getVideo(data.id),

As its been reporting as Inappropriate blocking method call, Even when Inside: withContext(Dispatchers.IO){}

So how to make this work asychronous...? even intellij is reporting Inappropriate blocking method call

Correct me if I am Wrong somewhere...,Thanks in Advance.

Shabinder commented 4 years ago

As per my understanding , with withContext(Dispatchers.IO){val video = ytDownloader?.getVideo(data.id)}, i am dedicating another thread than my Main Ui Thread to do this work ,Which is in blocking nature for that thread ...., But then why I still see a UI Freeze for a second or two .....,....

I am confused , or do i need to rewrite your library for making it asynchronous fully....Help me understand , will you,please?

Shabinder commented 4 years ago

I got it working efficientely after some tinkering by using various threads specific for various calls , I am sorry for going quite offtopic.

sealedtx commented 4 years ago

@Shabinder it makes sense to add async api for parsing video meta, because now there is only async downloading

Shabinder commented 4 years ago

@Shabinder it makes sense to add async api for parsing video meta, because now there is only async downloading

Ohk ..., Will research upon that and subtitles too ,as i need them in my personal project too....