0

I want to embed youtube functionality in my Qt GUI Application.

I've checked the youtubeview example of Qt but it does not work, because (I believe&assume) they used the Youtube Data API v2 and URLs are not valid anymore.

Is it feasible to do this in Qt? Could someone provide a minimal sample code for Qt, (if possible for QML)?

OnurA
  • 611
  • 2
  • 11
  • 25
  • Which Qt you have? I can open youtube links correctly with Qt5.5.1 and latest QtWebKit version. –  Mar 10 '16 at 14:18
  • I have the same version [Qt-5.5.1] – OnurA Mar 10 '16 at 15:06
  • What OS are you using? –  Mar 10 '16 at 15:10
  • Have you enabled plugins like this: QWebSettings *defaultSettings = QWebSettings::globalSettings(); defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, true); defaultSettings->setAttribute(QWebSettings::PluginsEnabled, true); –  Mar 10 '16 at 15:12
  • No, can you do it also in QML? And what's the purpose? – OnurA Mar 10 '16 at 15:29

1 Answers1

0

There is a YouTube Played component available with V-Play. There is an example that uses poth the player API and the YouTube Data API: https://v-play.net/updates/release-2-18-1-javascript-promises-for-rest-services-tinder-swipe-material-cards-qml-qsortfilterproxymodel-qml-youtube-player

Minimum example for the player:

import VPlayApps 1.0

App {
  NavigationStack {
    Page {
      title: "YouTube Player"

      YouTubeWebPlayer {
        videoId: "KQgqTYCfJjM"
        autoplay: true
      }

    }
  }
}
Alex Huber
  • 503
  • 3
  • 11