Highlighted

html5 video player button

Explorer ,
Oct 06, 2020

Copy link to clipboard

Copied

with the video component control disable and having a single custom button to control the play and pause of the video.

 

what should be the exact format of the code or script for it. 

 

//===========

var _this = this;

_this.button_play.on('click', function () {
$('#videoplayer')[0].play();
});

//===========

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

sure:

 

this.toggle_mc.addEventListener("click",toggleF);


function toggleF(){

if($('#v1')[0].paused){
$('#v1')[0].play();

} else {

$('#v1')[0].pause();

}
}

Views

54

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

html5 video player button

Explorer ,
Oct 06, 2020

Copy link to clipboard

Copied

with the video component control disable and having a single custom button to control the play and pause of the video.

 

what should be the exact format of the code or script for it. 

 

//===========

var _this = this;

_this.button_play.on('click', function () {
$('#videoplayer')[0].play();
});

//===========

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

sure:

 

this.toggle_mc.addEventListener("click",toggleF);


function toggleF(){

if($('#v1')[0].paused){
$('#v1')[0].play();

} else {

$('#v1')[0].pause();

}
}

Views

55

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 06, 2020 0
Adobe Community Professional ,
Oct 06, 2020

Copy link to clipboard

Copied

that should work.  use pause() to stop the video.

 

my personal preference (for no good reason) is to use the more verbose:

 

this.stop_mc.addEventListener("click",stopF);
this.play_mc.addEventListener("click",playF);


function playF(){
$('#v1')[0].play();
}


function stopF(){
$('#v1')[0].pause();
}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 06, 2020 2
Explorer ,
Oct 06, 2020

Copy link to clipboard

Copied

is there a way we can use single button to control the play and pause?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 06, 2020 0
Adobe Community Professional ,
Oct 07, 2020

Copy link to clipboard

Copied

sure:

 

this.toggle_mc.addEventListener("click",toggleF);


function toggleF(){

if($('#v1')[0].paused){
$('#v1')[0].play();

} else {

$('#v1')[0].pause();

}
}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 07, 2020 2
Explorer ,
Oct 07, 2020

Copy link to clipboard

Copied

yes this is working for my need.

 

Thank you @kglad 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 07, 2020 0
kglad LATEST
Adobe Community Professional ,
Oct 08, 2020

Copy link to clipboard

Copied

you're welcome.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 08, 2020 1