QMLPlayer and the QML controls have problems with percent encoded URL's
It seems something on the QML side of things is mangling URLs passed to the player. An example URL is http://192.168.1.204:55555/BBC%20ONE%20N%20West
"Player http://192.168.1.204:55555/BBC%20ONE%20N%20West" will work fine.
But try "QMLPlayer http://192.168.1.204:55555/BBC%20ONE%20N%20West" and you get a 404 not found.
You get the same problem when setting the 'source' property of any of the QML controls as well.
In QML, source is a QUrl. Seems Qt decode the url first, then the url passed to player is http://192.168.1.204:55555/BBC ONE N West. So you can encode the url first.
OK thanks that works :)
For anyone who comes across this in the future you need to do something like this if you want to pass a percent encoded URL.
source: encodeURI("http://192.168.1.204:55555/BBC%20ONE%20N%20West");
Personally I think the behaviour should be consistent with all the other players I tried including the C++ Player and just accept the URL as is but having to encode the URL first is an easy work around.
This is a bug!
If you use default Image element of QtQuick, you can use source as this:
source: "http://192.168.1.200/Image/logo (copy).png"
and it works fine! but in QMLPlayer source must be as following to works correct:
source: decodeURI(decodeURI("http://192.168.1.200/Video/aammaamme (copy).mp4"));
This is double!
I noticed that URL changed to path and result passed to mpPlayer object (in QmlPlayerAV.cpp file). This should works by URL transparently as Qt.
Please reopen this issue.
Thanks
@seyedmmousavi
How can I reproduce it? Why you call decodeURI twice? The original url works.
excuse me. It must be encodeURI not decodeURI.
You can reproduce it as following:
-upload a video file into any http web server. change its name as aammaamme 1 2 3.mp4 with some space characters within it.
-open QMLPlayer example of the QtAV source code
-open main.qml file
-change value of source property of the player element to targeting your uploaded video as source: encodeURI(encodeURI("http://192.168.42.197/aammaamme (copy).mp4"))
-run application!
PLEASE NOTE:
-above sample video has some spaces characters. so you need to encode it. but in default Image element of the QtQuick you don't need to do it manually and it will be done internally.
-@paul-h has a url which already encoded and he needs to encode it again! (source: encodeURI("http://192.168.1.204:55555/BBC%20ONE%20N%20West");)
@seyedmmousavi You are right. Thanks. Please try the latest code.
Good news! Thank you man 👍