Skip to content
This repository has been archived by the owner on Dec 6, 2018. It is now read-only.

Adds support to set "mute" attribute by default. #183

Merged
merged 4 commits into from
Jun 19, 2017

Conversation

andrebonon
Copy link
Contributor

Today there is no way to mute videos by default.
To do that a workaround is needed to set the volume to "0" on the "ready" event. It causes some unwanted noises if the browser performance is not good.

If this pull request is accepted, developers can set the video to be muted by default.
Besides, I changed the volume icon to mute/unmute the video and added a volume range on the user interface to control the volume level.

This feature will be very useful to me in particular and hope this can help others too.

Adds examples to set mute by default.
Copy link
Contributor

@lincolnfrog lincolnfrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reviewing this closely, I want to accept this PR. Testing right now...

Copy link
Contributor

@lincolnfrog lincolnfrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great overall! Couple minor issues, and then we can merge :)

@@ -47,6 +47,12 @@ function Player(selector, contentInfo) {
// Expose a public .isPaused attribute.
this.isPaused = false;

// Expose a plublic .isMuted attribute.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"public"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Player.prototype.mute = function(muteState) {
var data = {
muteState: muteState
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should toggle this.isMuted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm already toggling in:

205    case 'muted':
206      this.isMuted = data;
207      this.emit('mute', data);
208      break;

I followed the play/pause example. Is this right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sorry, you are right. I will probably need to change my volume impl to look more like what you did. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@@ -23,7 +23,8 @@ function onLoad() {
height: 480,
video: 'congo_2048.mp4',
is_stereo: true,
loop: false,
loop: true,
//muted: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you uncomment this and set muted: true, then the video does start muted but the UI doesn't show the muted state. Can this be fixed easily?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

andrebonon and others added 2 commits June 19, 2017 15:44
* Makes the video example start muted by default.
Copy link
Contributor

@lincolnfrog lincolnfrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last change!

@@ -23,7 +23,8 @@ function onLoad() {
height: 480,
video: 'congo_2048.mp4',
is_stereo: true,
loop: false,
loop: true,
muted: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not check this in as true :). Maybe check it in commented out as true?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to clarify: I think we should leave loop: false and comment out muted: true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to me.

* Comment out the muted attribute.
@lincolnfrog lincolnfrog merged commit 03cb429 into googlearchive:master Jun 19, 2017
@andrebonon andrebonon deleted the issue_170 branch June 19, 2017 19:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants