Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.15.0
-
None
-
macOS Catalina 10.15.4, Xcode 11.5
-
-
9c16be3d9d956f612dda431f4883eab3b09a8b67 (qt/qtmultimedia/dev) d6076e0963b16ec98c13ce126db1d94a8f2952ca (qt/qtmultimedia/5.15)
Description
QMediaPlayer fails to play media from built-in resource when app name has spaces:
QApplication::setApplicationName("App Name");
this is happens due to space character passed to NSURL.
any Qt below 5.15 is not affected. bug appeared only with Qt 5.15
for example, Qt 5.12.8 uses QUrl.toEncoded() before creating of NSURL:
//Load AVURLAsset //initialize asset using content's URL NSString *urlString = [NSString stringWithUTF8String:content.canonicalUrl().toEncoded().constData()]; NSURL *url = [NSURL URLWithString:urlString]; [(AVFMediaPlayerSessionObserver*)m_observer setURL:url];
but Qt 5.15 uses QUrl.toString(), which has different behavior:
//Load AVURLAsset //initialize asset using content's URL setURL(m_observer, m_resources.request().url().toString());
static void setURL(void *observer, const QString &url, const QString &mimeType = QString()) { NSString *urlString = [NSString stringWithUTF8String:url.toUtf8().constData()]; NSURL *nsurl = [NSURL URLWithString:urlString]; [static_cast<AVFMediaPlayerSessionObserver*>(observer) setURL:nsurl mimeType:[NSString stringWithUTF8String:mimeType.toLatin1().constData()]]; }
and as result invalid URL like that for temporary file is generated, and later passed to AVFMediaPlayerSessionObserver.
file:///private/var/folders/6t/zk9vl9js75d6lh4921f4xytr0000gn/T/App Name.aoeRPH.wav
AVPlayer remains in unknown state because
AVFMediaPlayerSession::processLoadStateChange()
is NOT called at all.
QMediaPlayer::mediaStatus() reports QMediaPlayer::LoadingMedia and QMediaPlayer::LoadedMedia is never happen
Attachments
Issue Links
- is duplicated by
-
QTBUG-85458 AVFMediaPlayerSession::setMedia() fails if QUrl contains spaces
- Closed
-
QTBUG-84573 QMediaPlayer does not play local file with spaces in name
- Closed
-
QTBUG-84564 Media player remains in the "loading" state if the source path contains spaces
- Closed