2

In qgis 2.16 was improved map tip (changelog.qgis.org/en/qgis/version/2.16.0/#map-tip-improvements) I did some tests to viewing a youtube video using:

<Iframe width = "420" height = "315" src = "https://www.youtube.com/embed/XGSy3_Czz8k?autoplay=1"> </ Iframe>

(See screenshot) in the map canvas appears only a black rectangle.

where am I wrong? how do you see the video?

Win 10 64 bit; OSGeo4W

enter image description here

2
  • Copying/pasting your code gives me a box but with an error. I couldn't find much information online regarding how these embeded videos work in QGIS which is a shame considering they mentioned it's possible...
    – Joseph
    Aug 16, 2016 at 11:25
  • I tried in QGIS 3.0 Girona, it does not work !!! Qt 5.9.2 :-(
    – pigreco
    Mar 2, 2018 at 10:56

2 Answers 2

3

I tried your iframe code and on my ubuntu machine it works without problems (video and audio).

your iframe

I don't have a windows around here now. I also tried vimeo:

<iframe src="https://player.vimeo.com/video/173774749" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p><a href="https://vimeo.com/173774749">Photo functionality in QField</a> from <a href="https://vimeo.com/user36168865">OPENGIS.ch</a> on <a href="https://vimeo.com">Vimeo</a>.</p>

layer settings

vimeo iframe without issues.

So the answer is, you are doing it exactly as it is ment to be done, but something could be wrong with this feature under windows.

could you try the vimeo code? and which version of QT are you running (Help -> about)?

2
  • i used your vimeo code but it still doesn't fully work. the only thing i get is a static preview of the video, namely the first frame. my QT version is 4.8.5. cheers and talk again soon
    – pigreco
    Aug 17, 2016 at 21:47
  • I tried in QGIS 3.0 Girona, it does not work !!! Qt 5.9.2 :-(
    – pigreco
    Mar 2, 2018 at 10:57
2

Ok, I found the problem and it is windows related only.

See: http://blog.enthought.com/open-source/fun-with-qtwebkit-html5-video/

The relevant part is where it says:

One of the components of the Qt toolkit is the Phonon library, which provides various classes related to streaming and playing media, and until recently QtWebKit used Phonon to embed media players in web pages. It was decided that the Phonon API was a higher level API than many multimedia applications would need, so the QtMultiMediaKit API was started as a lower-level replacement and Phonon was deprecated. The Windows QtWebKit code was ported to use QtMultiMediaKit instead of Phonon and with the Qt 4.8 release it no longer uses the Phonon back-end.

However, at about the same time the transition of Qt from Nokia to Digia happened and the development of QtMultiMediaKit (as part of the qt-mobility libraries and plugins) was paused in a not quite completed state, and so it hasn’t been fully incorporated into the Qt distribution yet. So this means that out of the box QtWebKit is not able to play HTML5 media on Windows, because the code for the multimedia plugin it is expecting to use is not included. QtWebKit’s HTML5 media features on Windows is basically caught in a gap between past and future technologies. I believe that QtWebKit is still using Phonon on the other platforms.

So it is something that would need to be fixed in the qgis windows installer. I'll have a look with the release manager and see what we can do.

3
  • with regret that videos can not be seen even in QGIS 2.99 dev
    – pigreco
    Sep 18, 2017 at 16:02
  • Tested a number of ways using QGIS 2.18.x and QGIS 3.2. Using web view and embedded video in HTML5 2.18.x nothing in the webviewer, 3.2 shows the HTML5 video controls but nothing happens when you use them. Used a YouTube link and got Not Supported Browser in 2.18.x and Something went wrong using 3.2. Tried a file\attachment as well, using both the MP4 and WMV file formats and the HTML with the embedded video, the HTML came up blank in both and in 2.18.x I got play/pause button and the VLC icon but still no playback. 3.2 was blank. Seems the only way is to use a hyperlink to the video still.
    – MrKingsley
    Jun 26, 2018 at 14:31
  • I did a test with QGIS 3.20.2 Hannover with Qt 5.15.2 version, VIMEO videos work, but Youtube ones don't :-( this is the code used: <iframe src = "player.vimeo.com/video/173774749" width = "640" height = "360" frameborder = "0" hello, w QGIS> </iframe>
    – pigreco
    Aug 31, 2021 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.