Skip to content

Commit

Permalink
Cherry pick PR #2687: Don't raise error in HTMLMediaElement.h5vccAudi…
Browse files Browse the repository at this point in the history
…oConnectors (#2715)

Refer to the original PR: #2687

b/330929788

Co-authored-by: Colin Liang <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and zhongqiliang committed Apr 6, 2024
1 parent 3b1a3ab commit 8cf6c74
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
12 changes: 3 additions & 9 deletions cobalt/dom/html_media_element.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include "cobalt/base/tokens.h"
#include "cobalt/cssom/map_to_mesh_function.h"
#include "cobalt/dom/document.h"
#include "cobalt/dom/eme/media_encrypted_event.h"
#include "cobalt/dom/eme/media_encrypted_event_init.h"
#include "cobalt/dom/html_element_context.h"
#include "cobalt/dom/html_video_element.h"
#include "cobalt/dom/media_settings.h"
Expand All @@ -50,9 +52,6 @@
#include "cobalt/web/web_settings.h"
#include "starboard/system.h"

#include "cobalt/dom/eme/media_encrypted_event.h"
#include "cobalt/dom/eme/media_encrypted_event_init.h"

namespace cobalt {
namespace dom {

Expand Down Expand Up @@ -645,16 +644,13 @@ void HTMLMediaElement::ScheduleEvent(const scoped_refptr<web::Event>& event) {
event_queue_.Enqueue(event);
}

std::string HTMLMediaElement::h5vcc_audio_connectors(
script::ExceptionState* exception_state) const {
std::string HTMLMediaElement::h5vcc_audio_connectors() const {
static const CobaltExtensionConfigurableAudioWriteAheadApi* extension_api =
static_cast<const CobaltExtensionConfigurableAudioWriteAheadApi*>(
SbSystemGetExtension(
kCobaltExtensionConfigurableAudioWriteAheadName));
if (extension_api) {
if (!player_) {
web::DOMException::Raise(web::DOMException::kInvalidStateErr,
exception_state);
return std::string();
}

Expand All @@ -666,8 +662,6 @@ std::string HTMLMediaElement::h5vcc_audio_connectors(
return base::JoinString(configs, ";");
}

web::DOMException::Raise(web::DOMException::kNotSupportedErr,
exception_state);
return std::string();
}

Expand Down
3 changes: 1 addition & 2 deletions cobalt/dom/html_media_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ class HTMLMediaElement : public HTMLElement,
// Returns semicolon separated names of audio connectors, like
// "hdmi;bluetooth".
// TODO(b/267678497): The current interface is tentative, to be refined.
std::string h5vcc_audio_connectors(
script::ExceptionState* exception_state) const;
std::string h5vcc_audio_connectors() const;

// Set max video capabilities.
void SetMaxVideoCapabilities(const std::string& max_video_capabilities,
Expand Down
5 changes: 2 additions & 3 deletions cobalt/dom/html_media_element.idl
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ interface HTMLMediaElement : HTMLElement {
attribute boolean muted;

// non standard, semicolon separated names of audio connectors, like
// "hdmi;bluetooth". It raises `NotSupportedError` on apps doesn't support
// this feature, or `InvalidStateError` if there isn't an active playback.
// "hdmi;bluetooth".
// TODO(b/267678497): The current interface is tentative, to be refined.
[RaisesException] readonly attribute DOMString h5vccAudioConnectors;
readonly attribute DOMString h5vccAudioConnectors;
};

0 comments on commit 8cf6c74

Please sign in to comment.