Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement HTMLMediaElement.volume attribute #22292

Closed
ferjm opened this issue Nov 28, 2018 · 12 comments
Closed

Implement HTMLMediaElement.volume attribute #22292

ferjm opened this issue Nov 28, 2018 · 12 comments

Comments

@highfive
Copy link

@highfive highfive commented Nov 28, 2018

Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in the #servo channel in IRC.

If you intend to work on this issue, then add @highfive: assign me to your comment, and I'll assign this to you. 😄

@lucasfantacuci
Copy link
Contributor

@lucasfantacuci lucasfantacuci commented Nov 28, 2018

Hi, I'm very new to the open source world.
Though I'm pretty sure that I'll need some mentoring, I'd like to help on this issue.

@lucasfantacuci
Copy link
Contributor

@lucasfantacuci lucasfantacuci commented Nov 28, 2018

As I could see, I have to change the HTMLMediaElement struct (in file : servo/components/script/dom/htmlmediaelement.rs) by adding this new volume field.

Probably, I'll have to change either the HTMLMediaElement::new_inherited() function that build this object.

Will I have to handle how to retrieve this value?
Or will I have to make a check in this function?

'Cause in the specification says that : "If the new value is outside the range 0.0 to 1.0 inclusive, then, on setting, an "IndexSizeError" DOMException must be thrown instead."

@lucasfantacuci
Copy link
Contributor

@lucasfantacuci lucasfantacuci commented Nov 28, 2018

@highfive: assign me

@highfive
Copy link

@highfive highfive commented Nov 28, 2018

Hey @lucasfantacuci! Thanks for your interest in working on this issue. It's now assigned to you!

@highfive highfive added the C-assigned label Nov 28, 2018
@jdm
Copy link
Member

@jdm jdm commented Nov 28, 2018

There will be six parts to this:

@ferjm will likely need to provide a bit more guidance on the final two steps.

@lucasfantacuci
Copy link
Contributor

@lucasfantacuci lucasfantacuci commented Nov 29, 2018

Oh, thx Sir. I'm following the guides, and as soon as possible, I gonna create a PR.

@ferjm
Copy link
Member Author

@ferjm ferjm commented Nov 29, 2018

signal the media player (via this interface) to change the volume

You'll need to add a new set_volume function to the Player trait. There are two implementations of this trait: a dummy one, for the platforms where we don't have gstreamer support yet, and the gstreamer one.

For the gstreamer implementation, we have the inner_player_proxy! macro. You can take set_input_size as an example of how to add the new set_volume to the trait implementation and to the PlayerInner struct.

add support for the new signal in the gstreamer backend

The gst-player function that changes the volume is set_volume

@ferjm ferjm added this to In progress in Media playback Nov 29, 2018
@lucasfantacuci
Copy link
Contributor

@lucasfantacuci lucasfantacuci commented Nov 29, 2018

Sirs, should I create any kind of test for it?

@ferjm
Copy link
Member Author

@ferjm ferjm commented Nov 29, 2018

There are already some Web Platform Tests for this:

  • ./mach test-wpt tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/audio_volume_check.html
  • ./mach test-wpt tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/video_volume_check.html
  • ./mach tests-wpt tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/event_volumechange.html

You will likely need to update the tests expectations since hopefuly all or at least some of these tests will start passing.

@lucasfantacuci
Copy link
Contributor

@lucasfantacuci lucasfantacuci commented Nov 30, 2018

Hi Sirs, I'm stucked trying to realize how to deal with that:

I changed the .webidl file, so it will execute a script, that enforces me to implement two methods into HTMLMediaElementMethods.

The getter one and the setter one. Here is what the command ./mach check throws me:

image

Since it says that the SetVolume must return the unit type "()".

How should I check the provided value in this setter?

I was expecting to return something like Err("IndexSizeError"), but I can't return anything.

Therefore, at the player trait I can return a kind of error, so,

Should I code this provided value checking at the interface realization?
If not, how should I handle it?

@jdm
Copy link
Member

@jdm jdm commented Nov 30, 2018

You will need to aadd the [Throws] annotation to the webidl to allow it to return a Result value that is converted into a JS exception.

bors-servo added a commit that referenced this issue Dec 10, 2018
…lume_attribute, r=<try>

Implementing HTMLMediaElement.volume attribute

<!-- Please describe your changes on the following line: -->
Work In Progress. Do not Accept.
This P.R. is going to implement the volume attribute to the HTMLMediaElement

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22292.
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22324)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 11, 2018
…lume_attribute, r=<try>

Implementing HTMLMediaElement.volume attribute

<!-- Please describe your changes on the following line: -->
Work In Progress. Do not Accept.
This P.R. is going to implement the volume attribute to the HTMLMediaElement

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22292.
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22324)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 12, 2018
…lume_attribute, r=ferjm

Implementing HTMLMediaElement.volume attribute

<!-- Please describe your changes on the following line: -->
This P.R. is going to implement the volume attribute to the HTMLMediaElement

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22292.
<!-- Either: -->
- [x] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22324)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 12, 2018
…lume_attribute, r=ferjm

Implementing HTMLMediaElement.volume attribute

<!-- Please describe your changes on the following line: -->
This P.R. is going to implement the volume attribute to the HTMLMediaElement

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22292.
<!-- Either: -->
- [x] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22324)
<!-- Reviewable:end -->
Media playback automation moved this from In progress to Done Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.