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 (#2714)

Refer to the original PR: #2687

b/330929788

Co-authored-by: Colin Liang <[email protected]>
  • Loading branch information
1 parent 40d0d90 commit 07c292d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
11 changes: 3 additions & 8 deletions cobalt/dom/html_media_element.cc
Original file line number Diff line number Diff line change
Expand Up @@ -644,21 +644,16 @@ 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 {
#if SB_API_VERSION >= 15
if (!player_) {
web::DOMException::Raise(web::DOMException::kInvalidStateErr,
exception_state);
return std::string();
return "";
}

std::vector<std::string> configs = player_->GetAudioConnectors();
return base::JoinString(configs, ";");
#else // SB_API_VERSION >= 15
web::DOMException::Raise(web::DOMException::kNotSupportedErr,
exception_state);
return std::string();
return "";
#endif // SB_API_VERSION >= 15
}

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 07c292d

Please sign in to comment.