// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. module media_router.mojom; import "chrome/common/media_router/mojo/media_status.mojom"; import "mojo/common/time.mojom"; // Interface for a controller to change the current state of a media content. // This interface should be kept free of details specific to Media Router, so // that it can be moved to the media namespace and be reused for other features // in the future. interface MediaController { // Starts playing the media if it is paused. Is a no-op if not supported by // the media or the media is already playing. Play(); // Pauses the media if it is playing. Is a no-op if not supported by the media // or the media is already paused. Pause(); // Mutes the media if |mute| is true, and unmutes it if false. Is a no-op if // not supported by the media. SetMute(bool mute); // Changes the current volume of the media, with 1 being the highest and 0 // being the lowest/no sound. Does not change the (un)muted state of the // media. Is a no-op if not supported by the media. SetVolume(float volume); // Sets the current playback position. |time| must be less than or equal to // the duration of the media. Is a no-op if the media doesn't support seeking. Seek(mojo.common.mojom.TimeDelta time); // Requests additional interface for commands used only for Hangouts routes. // TODO(crbug.com/684642): Moving this method to the MediaRouteProvider // interface (and modifying it to also take a MediaController& as input) can // result in a simpler state for MediaController. It will be easier to reason // about from point of view of process boundaries, and there will be // stronger guarantees w.r.t. MediaController API contract. The tradeoff is // code duplication (with CreateMediaRouteController API) and additional // boilerplate code in media_router_bindings.js and in the MR extension. // Revisit this API design after M62 when requirements for additional types // of controllers (e.g., mirroring) are more clear. ConnectHangoutsMediaRouteController( HangoutsMediaRouteController& controller_request); }; // Controller commands specific to Hangouts routes. The interface is obtained // by calling MediaController::ConnectHangoutsMediaRouteController. interface HangoutsMediaRouteController { // Sets the "local present" (aka "smooth motion") mode of the Hangouts // associated with the MediaRoute. SetLocalPresent(bool local_present); };