Merge lp:~stolowski/unity-scopes-api/inline-playback-doc into lp:unity-scopes-api/devel

Proposed by Paweł Stołowski
Status: Merged
Approved by: Marcus Tomlinson
Approved revision: 666
Merged at revision: 663
Proposed branch: lp:~stolowski/unity-scopes-api/inline-playback-doc
Merge into: lp:unity-scopes-api/devel
Diff against target: 94 lines (+67/-0)
2 files modified
doc/tutorial.dox (+64/-0)
src/scopes/CategoryRenderer.cpp (+3/-0)
To merge this branch: bzr merge lp:~stolowski/unity-scopes-api/inline-playback-doc
Reviewer Review Type Date Requested Status
Marcus Tomlinson (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+288123@code.launchpad.net

Commit message

Documentation for inline playback and concierge mode.

Description of the change

Documentation for inline playback and concierge mode.

To post a comment you must log in.
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

Looks good! Thanks! Just one spelling mistake.

review: Needs Fixing
663. By Paweł Stołowski

Fix spelling

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

Just a reminder here to update the docs in CategoryRenderer.cpp as well :) Thanks Pawel

review: Needs Fixing
664. By Paweł Stołowski

Added CategoryRenderer doc

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

Awesome thanks! 3 small things:

1)

You've added the "Inline music playback" section under the "Case 2: An aggregating scope" section of the tutorial. Could you move it to "Case 1: A simple (non-aggregating) scope".

2)

Could you change:

    "e.g. songs from same album; they will be played in the background when the main..."

to:

    "e.g. songs from same album; they will be played in sequence when the main..."

I get what you're trying to say, but "in the background" almost implies that they'll all be played on top of each other at the same time.

3)

Also later:

    "(an array of uris of additional songs to be played in the background)"

to:

    "(an array of uris of additional songs to be played in sequence when the main song finishes)"

review: Needs Fixing
665. By Paweł Stołowski

Doc fixes

666. By Paweł Stołowski

-the

Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/tutorial.dox'
2--- doc/tutorial.dox 2015-12-10 11:14:24 +0000
3+++ doc/tutorial.dox 2016-03-08 10:11:38 +0000
4@@ -657,6 +657,70 @@
5 }
6 \endcode
7
8+\paragraph inlineplayback Inline music playback
9+
10+Results which represent music (songs, albums etc.) can contain an extra data about audio content and can then be played directly from the Dash.
11+Such results have a "play" button overlaid on them. To create results that support this functionality two conditions must be met:
12+<ul>
13+<li>Category renderer definition must contain the "quick-preview-type" key with the value of "audio" in the "template" section;
14+<li>Results in the respective category must contain a "quick-preview-data" attribute, each of them is a dictionary with the extra playback data described
15+below.
16+</ul>
17+
18+The data assigned to "quick-preview-data" attribute of a Result needs to contain the following keys:
19+<ul>
20+<li>uri - a playable uri of a media file (path of a local file, or http uri).
21+<li>duration - the duration of the media file, in seconds.
22+<li>playlist - an array of uris of additional songs, e.g. songs from same album; they will be played in sequence when the main
23+song denoted by 'uri' finishes.
24+</ul>
25+
26+Here is an example of a category renderer for inline playback, which uses component mapping to map quick-preview-data to audio-data attribute of a result:
27+\code{.cpp}
28+static const char CATEGORY_RENDERER[] = R"(
29+{
30+ "schema-version": 1,
31+ "template": {
32+ "category-layout": "grid",
33+ "card-size": "large",
34+ "card-layout" : "horizontal",
35+ "quick-preview-type" : "audio"
36+ },
37+ "components": {
38+ "title": "title",
39+ "art": {
40+ "field": "art"
41+ },
42+ "subtitle": "artist",
43+ "quick-preview-data": {
44+ "field": "audio-data"
45+ }
46+ }
47+}
48+)";
49+\endcode
50+
51+A sample code that creates a result card representing a song and all songs from same album in a background playlist may look this way:
52+\code{.cpp}
53+
54+CategorisedResult res(category);
55+res.set_uri(uri);
56+res.set_title(media.getTitle());
57+...
58+
59+VariantMap inline_playback_data;
60+inline_playback_data["uri"] = uri;
61+inline_playback_data["duration"] = song_duration_in_seconds;
62+VariantArray playlist;
63+for (const std::string& song: album_songs)
64+{
65+ playlist.push_back(Variant(song.getUri()));
66+}
67+inline_playback_data["playlist"] = playlist;
68+res["audio-data"] = inline_playback_data;
69+
70+\endcode
71+
72 \subsubsection aggscope Case 2: An aggregating scope
73
74 Aggregating scopes are scopes that collect results from other scopes and possibly consolidate, modify, or re-categorise
75
76=== modified file 'src/scopes/CategoryRenderer.cpp'
77--- src/scopes/CategoryRenderer.cpp 2016-01-18 17:50:16 +0000
78+++ src/scopes/CategoryRenderer.cpp 2016-03-08 10:11:38 +0000
79@@ -69,6 +69,7 @@
80 \arg \c collapsed-rows Number of result rows displayed while the category is collapsed; possible values: any non-negative integer, where 0 fully expands the category (only affects grid and vertical journal)
81 \arg \c card-background Background color for the cards; string; URI in the format \verbatim color:///#rrggbb \endverbatim or \verbatim color:///color_name
82 \endverbatim or \verbatim gradient:///#rrggbb/#rrggbb \endverbatim or an image URI (will be stretched)
83+\arg \c quick-preview-type The type of media content represented by result cards, for use with inline playback; the only currently supported type is "audio".
84
85 \subsection components1 components keys
86
87@@ -83,6 +84,8 @@
88 \arg \c background Card background URI, can override the default specified in the card-background field of the template section (same format as for card-background)
89 \arg \c attributes Array of dictionaries specifying text and an optional icon (keys: "value", "icon")
90 \arg \c overlay-color Color of overlay for templates with overlay
91+\arg \c quick-preview-data A dictionary with the following keys: \c "uri" (an uri of audio stream or file), \c "duration" (duration in seconds), \c "playlist"
92+(an array of uris of additional songs to be played in sequence when the main song finishes).
93
94 \section example Example
95

Subscribers

People subscribed via source and target branches

to all changes: