Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1218)

Side by Side Diff: extensions/common/api/display_source.idl

Issue 1410093008: Introduce chrome.displaySource API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added warning message Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // The <code>chrome.displaySource</code> API creates a Display
6 // session using WebMediaStreamTrack as sources.
7 namespace displaySource {
8 enum ErrorType {
9 // Cannot create media pipeline from the given media stream which could be
10 // appropriate for a Display session.
11 // (e.g., necessary codecs are missing on the platform).
12 create_media_pipeline_error,
13 // A new Display session cannot be started before the existing one is termin ated.
14 exceeded_session_limit_error,
15 // Could not establish connection to the sink.
16 establish_connection_error,
17 // The capabilities of this Display Source and the connected
18 // sink do not fit (e.g. the sink cannot play the media content of
19 // the formats given by the source).
20 capabilities_negotiation_error,
21 // There was an error while packetizing and sending the media content.
22 media_send_error,
23 // The TCP connection with sink has dropped unexpectedly.
24 connection_error,
25 // An unexpected message has arrived from the sink.
26 unexpected_message_error,
27 // The sink became unresponsive.
28 timeout_error,
29 // Unspecified error.
30 unknown_error
31 };
32
33 dictionary ErrorInfo {
34 ErrorType type;
35 DOMString? description;
36 };
37
38 enum SinkState {
39 // Connected using this Display Source (i.e., there is an active session)
40 Connected,
41 // In process of connection to this Display Source
42 Connecting,
43 // Disconnected from this Display Source
44 Disconnected
45 };
46
47 dictionary SinkInfo {
48 // Id of the sink. It is guaranteed to be unique during the browser session.
49 long id;
50 // Human readable name of the sink.
51 DOMString name;
52 // State of the sink.
53 SinkState state;
54 };
55
56 dictionary AuthenticationInfo {
57 // Authentication method (e.g. ‘pin’ or ‘pbc’ )
58 DOMString method;
Reilly Grant (use Gerrit) 2015/11/10 18:51:34 Why not an enum here?
Mikhail 2015/11/11 13:36:04 The intention is to keep API generic and flexible
Reilly Grant (use Gerrit) 2015/11/11 18:36:13 If more mechanisms are added the API can be very e
59 // Authentication data (e.g. PIN value).
60 DOMString? data;
61 };
62
63 dictionary StartSessionInfo {
64 // Id of the sink to connect.
65 long sinkId;
66 // Authentication information.
67 AuthenticationInfo? authenticationInfo;
68 // The source audio track.
69 [instanceOf=MediaStreamTrack] object? audioTrack;
70 // The source audio track.
71 [instanceOf=MediaStreamTrack] object? videoTrack;
72 };
73
74 callback GetSinksCallback = void (SinkInfo[] result);
75 callback RequestAuthenticationCallback = void (AuthenticationInfo result);
76 callback TerminateSessionCallback = void ();
77
78 interface Functions {
79 // Queries the list of the currently available Display sinks.
80 //
81 // |callback| : Called when the request is completed. The argument list is e mpty
82 // if no available sinks were found.
83 static void getAvailableSinks(GetSinksCallback callback);
84
85 // Queries authentication data from the sink device.
86 //
87 // |sinkId| : Id of the sink
88 // |callback| : Called when authentication info retrieved from the sink. The argument
89 // |method| field contains the authentication method required by the sink fo r connection;
90 // the |data| field can be null or can contain some supplementary data provi ded by the
91 // sink.
92 // If authentication info cannot be retrieved from the sink the "chrome.runt ime.lastError"
93 // property is defined.
94 static void requestAuthentication(long sinkId, RequestAuthenticationCallback callback);
95
96 // Creates a Display session using the provided StartSessionInfo instance.
97 // The input argument fields must be initialized as described below:
98 // The |sinkId| must be a valid id of a sink (obtained via ‘getAvailableSin ks’).
99 //
100 // The |audioTrack| or |videoTrack| must be of type MediaStreamTrack.
101 // Either |audioTrack| or |videoTrack| can be null but not both. This
102 // means creating a session with only audio or video.
103 //
104 // The |authenticationInfo| can be null if no additional authentication data are required by
105 // the sink; otherwise its |data| field must contain the required authentica tion data (e.g.
106 // PIN value) and its |method| field must be the same as one obtained from
107 // ‘requestAuthentication’.
108 [nocompile] static void startSession(StartSessionInfo sessionInfo);
109
110 // Terminates the active Display session.
111 // |sinkId| : Id of the connected sink.
112 // |callback| : Called when the session is terminated.
113 [nocompile] static void terminateSession(long sinkId, optional TerminateSess ionCallback callback);
114 };
115
116 interface Events {
117 // Event fired when the available sinks are modified (either their amount or properties)
118 // |sinks| the list of all currently available sinks
119 static void onSinksUpdated(SinkInfo[] sinks);
120 // Event fired when the Display session is started.
121 // |sinkId| Id of the peer sink
122 [nocompile] static void onSessionStarted(long sinkId);
123 // Event fired when the Display session is terminated.
124 // |sinkId| Id of the peer sink
125 [nocompile] static void onSessionTerminated(long sinkId);
126 // Event fired when an error occurs.
127 // |sinkId| Id of the peer sink
128 // |errorInfo| error description
129 [nocompile] static void onSessionErrorOccured(long sinkId, ErrorInfo errorIn fo);
130 };
131 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698