Blainer
Blainer

Reputation: 2712

playing html5 player

The code below works but it plays ALL instances of the projekktor video player in the DOM simultaneously. How would I revise the code to only play the video within the same parent div as the .startb i click?

html

<div class="videoContainer">
        <div class="playerHolder">
            <div class="videoPlayer"><video class="projekktor" poster="poster.jpg" title="" width="640" height="385" controls>
            <source src="video.mp4" type="video/mp4" />
            <source src="video.webm" type="video/webm" />
            </video></div>
            <div class="startb"><img src="dbs/images/start.png"/></div>
            <div class="postImage"><img src="006_CCC_Magdelena_poster.jpg" title="" width="640" height="385" /></div>
        </div>
</div>

js

$('.startb').click(function() {
    projekktor('*').each(function() {
        this.setPlay();
    });
});   

Upvotes: 0

Views: 397

Answers (1)

Thierry Blais
Thierry Blais

Reputation: 2858

Try this:

$('.startb').click(function() {
     $(this).parent('div').find('.projekktor').setPlay();
});   

Upvotes: 1

Related Questions