OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The <code>chrome.displaySource</code> API creates a Display | 5 // The <code>chrome.displaySource</code> API creates a Display |
6 // session using WebMediaStreamTrack as sources. | 6 // session using WebMediaStreamTrack as sources. |
7 namespace displaySource { | 7 namespace displaySource { |
8 enum ErrorType { | 8 enum ErrorType { |
9 // Cannot create media pipeline from the given media stream which could be | 9 // Cannot create media pipeline from the given media stream which could be |
10 // appropriate for a Display session (e.g., necessary codecs are missing | 10 // appropriate for a Display session (e.g., necessary codecs are missing |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Authentication information. | 82 // Authentication information. |
83 AuthenticationInfo? authenticationInfo; | 83 AuthenticationInfo? authenticationInfo; |
84 // The source audio track. | 84 // The source audio track. |
85 [instanceOf=MediaStreamTrack] object? audioTrack; | 85 [instanceOf=MediaStreamTrack] object? audioTrack; |
86 // The source audio track. | 86 // The source audio track. |
87 [instanceOf=MediaStreamTrack] object? videoTrack; | 87 [instanceOf=MediaStreamTrack] object? videoTrack; |
88 }; | 88 }; |
89 | 89 |
90 callback GetSinksCallback = void (SinkInfo[] result); | 90 callback GetSinksCallback = void (SinkInfo[] result); |
91 callback RequestAuthenticationCallback = void (AuthenticationInfo result); | 91 callback RequestAuthenticationCallback = void (AuthenticationInfo result); |
92 callback TerminateSessionCallback = void (); | 92 |
| 93 // The callback is used by <code>startSession, terminateSession</code> |
| 94 // to signal completion. The callback is called with |
| 95 // <code>chrome.runtime.lastError</code> set to error |
| 96 // message if the call has failed. |
| 97 [inline_doc] callback CallCompleteCallback = void (); |
93 | 98 |
94 interface Functions { | 99 interface Functions { |
95 // Queries the list of the currently available Display sinks. | 100 // Queries the list of the currently available Display sinks. |
96 // | 101 // |
97 // |callback| : Called when the request is completed. The argument list | 102 // |callback| : Called when the request is completed. The argument list |
98 // is empty if no available sinks were found. | 103 // is empty if no available sinks were found. |
99 static void getAvailableSinks(GetSinksCallback callback); | 104 static void getAvailableSinks(GetSinksCallback callback); |
100 | 105 |
101 // Queries authentication data from the sink device. | 106 // Queries authentication data from the sink device. |
102 // | 107 // |
(...skipping 13 matching lines...) Expand all Loading... |
116 // ‘getAvailableSinks’). | 121 // ‘getAvailableSinks’). |
117 // | 122 // |
118 // The |audioTrack| or |videoTrack| must be of type MediaStreamTrack. | 123 // The |audioTrack| or |videoTrack| must be of type MediaStreamTrack. |
119 // Either |audioTrack| or |videoTrack| can be null but not both. This | 124 // Either |audioTrack| or |videoTrack| can be null but not both. This |
120 // means creating a session with only audio or video. | 125 // means creating a session with only audio or video. |
121 // | 126 // |
122 // The |authenticationInfo| can be null if no additional authentication data | 127 // The |authenticationInfo| can be null if no additional authentication data |
123 // are required by the sink; otherwise its |data| field must contain the | 128 // are required by the sink; otherwise its |data| field must contain the |
124 // required authentication data (e.g. PIN value) and its |method| field must | 129 // required authentication data (e.g. PIN value) and its |method| field must |
125 // be the same as one obtained from ‘requestAuthentication’. | 130 // be the same as one obtained from ‘requestAuthentication’. |
126 [nocompile] static void startSession(StartSessionInfo sessionInfo); | 131 // |callback| : Called when the session is started. |
| 132 [nocompile] static void startSession( |
| 133 StartSessionInfo sessionInfo, optional CallCompleteCallback callback); |
127 | 134 |
128 // Terminates the active Display session. | 135 // Terminates the active Display session. |
129 // |sinkId| : Id of the connected sink. | 136 // |sinkId| : Id of the connected sink. |
130 // |callback| : Called when the session is terminated. | 137 // |callback| : Called when the session is terminated. |
131 [nocompile] static void terminateSession( | 138 [nocompile] static void terminateSession( |
132 long sinkId, optional TerminateSessionCallback callback); | 139 long sinkId, optional CallCompleteCallback callback); |
133 }; | 140 }; |
134 | 141 |
135 interface Events { | 142 interface Events { |
136 // Event fired when the available sinks are modified (either their amount | 143 // Event fired when the available sinks are modified (either their amount |
137 // or properties) | 144 // or properties) |
138 // |sinks| the list of all currently available sinks | 145 // |sinks| the list of all currently available sinks |
139 static void onSinksUpdated(SinkInfo[] sinks); | 146 static void onSinksUpdated(SinkInfo[] sinks); |
140 // Event fired when the Display session is started. | 147 // Event fired when the Display session is started. |
141 // |sinkId| Id of the peer sink | 148 // |sinkId| Id of the peer sink |
142 [nocompile] static void onSessionStarted(long sinkId); | 149 [nocompile] static void onSessionStarted(long sinkId); |
143 // Event fired when the Display session is terminated. | 150 // Event fired when the Display session is terminated. |
144 // |sinkId| Id of the peer sink | 151 // |sinkId| Id of the peer sink |
145 [nocompile] static void onSessionTerminated(long sinkId); | 152 [nocompile] static void onSessionTerminated(long sinkId); |
146 // Event fired when an error occurs. | 153 // Event fired when an error occurs. |
147 // |sinkId| Id of the peer sink | 154 // |sinkId| Id of the peer sink |
148 // |errorInfo| error description | 155 // |errorInfo| error description |
149 [nocompile] static void onSessionErrorOccured(long sinkId, | 156 [nocompile] static void onSessionErrorOccured(long sinkId, |
150 ErrorInfo errorInfo); | 157 ErrorInfo errorInfo); |
151 }; | 158 }; |
152 }; | 159 }; |
OLD | NEW |