Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Cannot mute volume before video plays.


I want to show the first frame of the video as start image without playing the video.

I try to do this by muting the volume, call play(), and pause video after 500ms. But often I can hear audio for a second or so before video is paused.
Seems like mute and volume functions do not work.

My code looks like this:


jwplayer("video_jw_@vcf.ID").setup({
file: '@vcf.FullFilename',
bufferlength: 20,
width: 640,
height: 360,
primary: 'html5',
example_option: false,
controlbar: 'bottom',
autostart: false
});

jwplayer("video_jw_@vcf.ID").onReady(function () {
$this = this;
jwplayer("video_jw_@vcf.ID").setVolume(1);
jwplayer("video_jw_@vcf.ID").setMute(true);
jwplayer("video_jw_@vcf.ID").play();
});

jwplayer("video_jw_@vcf.ID").onPlay(function () {
$this = this;

var pauseMe = window.setTimeout(function () { // pause video
$this.pause();
}, 500);
});

5 Community Answers

Martin Nielsen

User  
0 rated :

I use Chrome (Version 59.0.3071.115 (Officiel version) (64-bit)) btw.

George

JW Player Support Agent  
1 rated :

Try something like this:
http://qa.jwplayer.com.s3.amazonaws.com/~george/single_mp4_pause.html

Martin Nielsen

User  
0 rated :

firstFrame event is not fired.

Martin Skovgaard Nielsen

User  
0 rated :

Oh, event did not exist in version 6.6. I have now upgraded at it seems to work :) So Thanks.

Of course I had to add code to make audio not muted when user clicks play:


jwplayer("video_jw_@vcf.ID").setup({
file: '@vcf.FullFilename',
bufferlength: 20,
width: 640,
height: 360,
primary: 'html5',
example_option: false,
controlbar: 'bottom',
mute: true,
autostart: true
}).on('firstFrame', function () {
setTimeout(function () {
jwplayer("video_jw_@vcf.ID").pause(true);
}, 200);
});

jwplayer("video_jw_@vcf.ID").onPlay(function () {
$this = this;

// read custom attribute on containing div
$attFirstPlay = $("#video_jw_@vcf.ID").attr('firstplay');

// Unmute when user clicks play!
if ($attFirstPlay == 'false') { // not run when video is first auto played.
$this.setMute(false);
$this.setVolume(100);
return;
}

// Only run first timne when video is auto played.
// Change custom attribute on containing div.
$("#video_jw_@vcf.ID").attr('firstplay', 'false');
});

George

JW Player Support Agent  
0 rated :

You could unmute from on(‘firstFrame’) too, no reason to track first play

This question has received the maximum number of answers.