[ANNOUNCE] QYouTube - Qt/C++ library and QML module
QYouTube is a Qt/C++ library and QML module for accessing the YouTube Data API (version 3). The library provides a number of classes providing read/write access to the YouTube Data API, categorized by resource type (activities, channels, videos etc). There are also accompanying data models for convenient display of data in item views. There are additional classes for obtaining a list of video streams and subtitles, which do not require access to the YouTube Data API.
Packages available for Maemo5 are:
- qyoutube - C++ library.
- qyoutube-qml - QML module exposing the classes to QML (depends on qyoutube).
- qyoutube-dev - Development headers for qyoutube.
QYouTube has also been tested against Qt5, so it should 'just work' on any platform supporting Qt4.7+.
Some links:
Quick video search example in QML:
Code:
import QtQuick 1.0
import QYouTube 1.0
Rectangle {
width: 800
height: 480
color: "#000"
Rectangle {
id: searchBox
height: 50
anchors {
left: parent.left
right: parent.right
top: parent.top
margins: 10
}
color: "#fff"
border {
width: 2
color: "green"
}
TextInput {
id: searchField
anchors.fill: parent
onAccepted: searchModel.list(["snippet"], {}, {type: "video", maxResults: 20, q: text})
}
}
ListView {
id: view
anchors {
left: parent.left
right: parent.right
top: searchBox.bottom
topMargin: 10
bottom: parent.bottom
}
clip: true
model: SearchModel {
id: searchModel
apiKey: MY_API_KEY
onStatusChanged: if (status == SearchRequest.Failed) console.log("SearchModel error: " + errorString);
}
delegate: Item {
width: view.width
height: 100
Image {
id: image
width: 120
height: 90
anchors {
left: parent.left
leftMargin: 10
verticalCenter: parent.verticalCenter
}
source: snippet.thumbnails["default"].url
}
Column {
anchors {
left: image.right
leftMargin: 10
right: parent.right
rightMargin: 10
verticalCenter: parent.verticalCenter
}
spacing: 10
Text {
width: parent.width
elide: Text.ElideRight
color: "#fff"
text: snippet.title
}
Text {
width: parent.width
elide: Text.ElideRight
color: "#999"
text: "By " + snippet.channelTitle
}
}
MouseArea {
anchors.fill: parent
onClicked: streams.list(id.videoId)
}
}
}
StreamsRequest {
id: streams
onFinished: {
if (status == StreamsRequest.Ready) {
for (var i = 0; i < result.length; i++) {
var stream = result[i];
console.log(stream.description + " - " + stream.width + "x" + stream.height + ": " + stream.url);
}
}
else {
console.log("StreamsRequest error: " + errorString);
}
}
}
}
http://marxoft.co.uk/static/images/q...utubeapp-1.png
|