Lines Matching refs:controller
18 2. 通过AVSessionController对象来调用,例如接口`controller.getAVPlaybackState()`。
79 AVSessionManager.createController(descriptor.sessionId).then((controller) => {
80 g_controller.push(controller);
82 console.error(`Failed to create controller. Code: ${err.code}, message: ${err.message}`);
122 AVSessionManager.createController(session.sessionId).then((controller) => {
123 g_controller.push(controller);
125 console.error(`Failed to create controller. Code: ${err.code}, message: ${err.message}`);
131 let index = g_controller.findIndex((controller) => {
132 return controller.sessionId === session.sessionId;
141 let index = g_controller.findIndex((controller) => {
142 return controller.sessionId === session.sessionId;
180 let controller = g_controller[0];
184 controller.on('activeStateChange', (isActive) => {
192 controller.on('sessionDestroy', () => {
194 controller.destroy().then(() => {
202 …controller.on('metadataChange', ['assetId', 'title', 'description'], (metadata: AVSessionManager.A…
206 …controller.on('playbackStateChange', ['state', 'speed', 'loopMode'], (playbackState: AVSessionMana…
210 controller.on('validCommandChange', (cmds) => {
222 controller.on('outputDeviceChange', (state, device) => {
226 controller.on('sessionEvent', (eventName, eventArgs) => {
230 controller.on('extrasChange', (extras) => {
234 controller.on('queueItemsChange', (items) => {
238 controller.on('queueTitleChange', (title) => {
248 // 假设我们已经有了一个对应session的controller,如何创建controller可以参考之前的案例
249 let controller = await AVSessionManager.createController("")
251 let sessionId = controller.sessionId;
252 console.info(`get sessionId by controller : isActive : ${sessionId}`);
254 let isActive = await controller.isActive();
255 console.info(`get activeState by controller : ${isActive}`);
257 let metadata = await controller.getAVMetadata();
258 console.info(`get media title by controller : ${metadata.title}`);
259 console.info(`get media artist by controller : ${metadata.artist}`);
261 let avPlaybackState = await controller.getAVPlaybackState();
262 console.info(`get playbackState by controller : ${avPlaybackState.state}`);
263 console.info(`get favoriteState by controller : ${avPlaybackState.isFavorite}`);
265 let queueItems = await controller.getAVQueueItems();
266 console.info(`get queueItems length by controller : ${queueItems.length}`);
268 let queueTitle = await controller.getAVQueueTitle();
269 console.info(`get queueTitle by controller : ${queueTitle}`);
271 let extras = await controller.getExtras();
272 console.info(`get custom media packets by controller : ${JSON.stringify(extras)}`);
274 let agent = await controller.getLaunchAbility();
275 console.info(`get want agent info by controller : ${JSON.stringify(agent)}`);
277 let currentTime = controller.getRealPlaybackPositionSync();
278 console.info(`get current playback time by controller : ${currentTime}`);
280 let validCommands = await controller.getValidCommands();
281 console.info(`get valid commands by controller : ${JSON.stringify(validCommands)}`);
294 // 假设我们已经有了一个对应session的controller,如何创建controller可以参考之前的案例
295 let controller = await AVSessionManager.createController("")
297 let validCommandTypeArray = await controller.getValidCommands();
298 console.info(`get validCommandArray by controller : length : ${validCommandTypeArray.length}`);
303 controller.sendControlCommand(avCommand);
308 controller.sendControlCommand(avCommand);
313 controller.sendControlCommand(avCommand);
318 controller.sendControlCommand(avCommand);
322 …await controller.sendCommonCommand(commandName, {command : 'This is my custom command'}).then(() =…
329 await controller.skipToQueueItem(queueItemId).then(() => {
344 // 假设我们已经有了一个对应session的controller,如何创建controller可以参考之前的案例
345 let controller = await AVSessionManager.createController("")
347 // 销毁当前的controller,销毁后这个controller将不在可用
348 controller.destroy((err: BusinessError) => {
350 console.error(`Failed to destroy controller. Code: ${err.code}, message: ${err.message}`);
352 console.info(`Destroy controller SUCCESS`);