Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.5.1, 5.11.2
-
-
fc33195f87d7b2b036f1df625a8fda12557e05e4
Description
If you set a url like "https://something.com/route/to/file.mp4" to a MediaPlayer or Video QML Items or their C++ Widget equivalent you get the following exception on QtAndroidMediaPlayer:
java.io.FileNotFoundException: No content provider: https://afdc1d5f7fc181fca110-0b1385a62d762ade5ff0a8631476a6a0.ssl.cf3.rackcdn.com/render.mp4
D/MediaPlayer( 8516): at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1117)
D/MediaPlayer( 8516): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:970)
D/MediaPlayer( 8516): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:897)
D/MediaPlayer( 8516): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1102)
D/MediaPlayer( 8516): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1065)
D/MediaPlayer( 8516): at org.qtproject.qt5.android.multimedia.QtAndroidMediaPlayer.setDataSource(QtAndroidMediaPlayer.java:371)
I think the problem arise because on line 371 of QtAndroidMediaPlayer has been used the following line of code:
mMediaPlayer.setDataSource(mActivity, mUri);
while according to official documentation on android developer portal (http://developer.android.com/guide/topics/media/mediaplayer.html), you should use a different setDataSource signature:
Playing from a remote URL via HTTP streaming looks like this:
String url = "http://........"; // your URL here
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(url);