Created attachment 104071 [details]
LibreOffice recently learned exporting embedded and linked videos to PDF. The export result is primarily validated by Adobe Acrobat, but I also checked okular. The embedded video plays nicely -- I think on openSUSE Leap 42.2 it's configured to use vlc for the actual video playing.
Linked video doesn't work, I'm attaching the details. First the reproducer document.
The document is created in LibreOffice by inserting a linked video from the filesystem, then tweaking the ODF file (zipped XML) manually so it links a HTTP URL instead.
[00007f613c00dce8] filesystem access error: cannot open file //home/vmiklos//home/vmiklos/http:/vmiklos.hu/file/small.mp4 (No such file or directory)
[00007f613c00dce8] core access error: File reading failed
[00007f613c00dce8] core access error: VLC could not open the file "//home/vmiklos//home/vmiklos/http:/vmiklos.hu/file/small.mp4" (No such file or directory).
[0000000001af96b8] core input error: open of `file:////home/vmiklos//home/vmiklos/http:/vmiklos.hu/file/small.mp4' failed
[0000000001af96b8] core input error: Your input can't be opened
[0000000001af96b8] core input error: VLC is unable to open the MRL 'file:////home/vmiklos//home/vmiklos/http:/vmiklos.hu/file/small.mp4'. Check the log for details.
Looks like it tries to convert http://vmiklos.hu/file/small.mp4 to a relative file:/// URL.
Confirmed, both with 0.26.1 from Debian Testing and with the current git master.
The problem is in the file videowidget.cpp, in the method VideoWidget::Private::load().
There, starting in line 110 is says
QString url = movie->url();
Here, url is the movie location, namely http:/vmiklos.hu/file/small.mp4
The code continues:
if ( QDir::isRelativePath( url ) )
newurl = document->currentDocument().adjusted(QUrl::RemoveFilename);
newurl.setPath( newurl.path() + url );
and sure enough, QDir::isRelativePath takes the content of 'url' to be a relative path, because it does not start with '/'. Hence the 'if' branch is taken, and the document path is prepended to the movie part. Seems like the code was not written with internet movies in mind.
Strangely enough, the code continues:
if ( newurl.isLocalFile() )
player->load( newurl );
player->load( newurl );
Surely that's not right? Martin, you introduced this in d8fdb1494 , can you please have a look?
Git commit ee7e3737f4d2031e9bac9f5a25ac0b31c2f5e496 by Albert Astals Cid.
Committed on 20/02/2017 at 00:06.
Pushed by aacid into branch 'Applications/16.12'.
Account for non local non relative video file urls
M +22 -32 ui/videowidget.cpp
Thanks a lot! :-)