After some debugging I finally found the root cause of the freeze: When we set source to the Audio or MediaPlayer element, QAndroidMediaPlayerControl::setMedia() will be called to set the media source to the underlying android MediaPlayer, then mediaChanged signal will be emitted, which lead to ---> QAndroidMetaDataReaderControl::onMediaChanged() ---> QAndroidMetaDataReaderControl::updateData() ---> AndroidMediaMetadataRetriever::extractMetadata() ---> android.media.MediaMetadataRetriever.extractMetadata() get called which will retrieve the meta data of the media file. android.media.MediaMetadataRetriever.extractMetadata() is apparently a synchronous API, when network is bad, it will wait until it fetched the meta-data (or failed) and please note that this is called under Qt's UI thread and it will freeze the UI for a potentially very long time.
On Wed, Nov 18, 2015 at 9:39 AM, Liang Jian <jianlian...@gmail.com> wrote: > When network is not good, MediaPlayer will freeze UI when playing a > remote video under android. After I set a video url to MediaPlayer, it > seems that it will fetch meta-data of the video first, and if the network > is not good, it will freeze UI for a very long time. > A very similar problem which is related to Audio quick element has > been reported in https://bugreports.qt.io/browse/QTBUG-46491. > This has become a very common issue for our app, since once our app > published a video to the internet, we will use CDN to speed up video > playback > from network, suppose at the first time a person in a area (I mean a CDN > node) > watch a video, CDN will fetch the whole content of the video from the > original > website to the current CDN node, this usually takes 10-20s (or even more), > that to say our android app will freeze the UI for 10-20s or even more > time! > A bug report has been submitted long time ago: > This issue only happen under android, it will not happen under Windows > or iOS. > Any suggestion to workaround this issue? thanks. >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest