// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library chromium.cast;
@discoverable
closed protocol ApplicationContext {
/// Returns `session_id` to use in the AudioConsumer API. May return 0
/// if there is no media session associated with the app. In this case
/// audio will be rendered through AudioRenderer.
strict GetMediaSessionId() -> (struct {
media_session_id uint64;
});
/// Used by the Agent to receive a controller from the Cast Runner.
/// Can only be called at most one time for the lifetime of the Component.
strict SetApplicationController(resource struct {
controller client_end:ApplicationController;
});
/// Called if the application component exits gracefully, with the same
/// `exit_code` as would be reported via `ComponentController.OnTerminated()`.
/// Values less than or equal to zero are `zx.Status` codes.
/// May be called at most once, immediately prior to termination.
strict OnApplicationExit(struct {
exit_code int64;
});
};