Skip to content

Comments

[NEW] Add pause and reset button when adding custom sound #13615

Merged
rodrigok merged 3 commits intoRocketChat:developfrom
knrt10:issue13614
May 15, 2019
Merged

[NEW] Add pause and reset button when adding custom sound #13615
rodrigok merged 3 commits intoRocketChat:developfrom
knrt10:issue13614

Conversation

@knrt10
Copy link
Contributor

@knrt10 knrt10 commented Mar 5, 2019

Closes #13614

Working example

@knrt10 knrt10 force-pushed the issue13614 branch 3 times, most recently from fb0fe9c to 812b420 Compare March 5, 2019 11:11
@knrt10 knrt10 changed the title [NEW] Add pause button when adding custom sound [NEW] Add pause and reset button when adding custom sound Mar 5, 2019
@knrt10
Copy link
Contributor Author

knrt10 commented Mar 19, 2019

@tassoevan would you please review

if ($audio && $audio[0] && $audio[0].play) {
$audio[0].play();
}
}, 'click .icon-pause-circled'(e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}, 'click .icon-pause-circled'(e) {
},
'click .icon-pause-circled'(e) {

if ($audio && $audio[0] && $audio[0].pause) {
$audio[0].pause();
}
}, 'click .icon-reset-circled'(e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}, 'click .icon-reset-circled'(e) {
},
'click .icon-reset-circled'(e) {

e.preventDefault();
e.stopPropagation();
const $audio = $(`audio#${ this._id }`);
console.log($audio);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
console.log($audio);

}, 'click .icon-pause-circled'(e) {
e.preventDefault();
e.stopPropagation();
const $audio = $(`audio#${ this._id }`);
Copy link
Contributor

Choose a reason for hiding this comment

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

You must avoid jQuery dependency replacing $(`audio#{ this._id }`) with instance.find(`audio#{ this._id }`) (where instance is the second argument passed to this function).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tassoevan I think instance.find() is null here

Copy link
Contributor

Choose a reason for hiding this comment

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

Ops, you're right, these <audio> tags are inserted somewhere else. Since they all have an ID, document.getElementById(this._id) will fit better.

@tassoevan tassoevan added type: bug area: ui Touches the code on client side type: improvement labels Mar 20, 2019
@knrt10
Copy link
Contributor Author

knrt10 commented Mar 20, 2019

@tassoevan updated the PR

Copy link
Contributor

@tassoevan tassoevan left a comment

Choose a reason for hiding this comment

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

Everything looks fine. As a final suggestion, please rename $audio as audio because it looks like Hungarian notation for jQuery objects.

@knrt10
Copy link
Contributor Author

knrt10 commented Mar 20, 2019

Updated @tassoevan

@tassoevan tassoevan added this to the 1.0.0 milestone Mar 21, 2019
@sampaiodiego sampaiodiego modified the milestones: 1.0.0, 1.1.0 Apr 2, 2019
@rodrigok rodrigok merged commit 1c8a843 into RocketChat:develop May 15, 2019
@sampaiodiego sampaiodiego mentioned this pull request May 28, 2019
@ashwaniYDV
Copy link
Contributor

@tassoevan @rodrigok I dont think we need seperate buttons for play/pause. While playing any media file, we have a single button for play/pause which conditionally changes. Also multiple audio can be played here too which is a bug. I have made a PR for this. Would you please review.
#16215

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ui Touches the code on client side type: improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NEW] Add pause and reset button when adding custom sound

5 participants