// Copyright © 2019 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; using CefSharp.Enums; namespace CefSharp { /// /// Implement this interface to handle audio events /// All methods will be called on the CEF UI thread /// public interface IAudioHandler { /// /// Called when the stream identified by has started. /// will always be called after ; /// both methods may be called multiple times for the same stream. /// /// the ChromiumWebBrowser control /// the browser object /// will uniquely identify the stream across all future IAudioHandler callbacks /// is the number of channels /// is the layout of the channels /// is the stream sample rate /// is the maximum number of frames that will occur in the PCM packet passed to OnAudioStreamPacket void OnAudioStreamStarted(IWebBrowser chromiumWebBrowser, IBrowser browser, int audioStreamId, int channels, ChannelLayout channelLayout, int sampleRate, int framesPerBuffer); /// /// Called when a PCM packet is received for the stream identified by /// Based on and the value passed to /// you can calculate the size of the array in bytes. /// /// /// will uniquely identify the stream across all future IAudioHandler callbacks /// is an array representing the raw PCM data as a floating point type, i.e. 4-byte value(s) /// is the number of frames in the PCM packet /// is the presentation timestamp (in milliseconds since the Unix Epoch) /// and represents the time at which the decompressed packet should be presented to the user void OnAudioStreamPacket(IWebBrowser chromiumWebBrowser, IBrowser browser, int audioStreamId, IntPtr data, int noOfFrames, long pts); /// /// Called when the stream identified by has stopped. /// will always be called after ; /// both methods may be called multiple times for the same stream. /// /// the ChromiumWebBrowser control /// the browser object /// will uniquely identify the stream across all future IAudioHandler callbacks void OnAudioStreamStopped(IWebBrowser chromiumWebBrowser, IBrowser browser, int audioStreamId); } }