1
votes

I am using Jwplayer for my videos to be played. so i was using JS fiddle to test JWplayer API

I had included JS file as instructed in jsfiddle. Video works fine but i am tring to have one button other than player control to pause/play the video .

but it doesnt seems to work i am not able to understand the problem

help me out here

<body>


   <div id='my-video'></div><br>
    <div id="content" style=" text-align: center;">
       <button name='play' id='play' value='play' onclick='play();'>Play</button>
        <button name='pause' id='pause' value='pause' onclick='pause();' style='display: none;'>Pause</button>
    </div>


</body>


<script>
       jwplayer('my-video').setup({
        file: 'http://content.bitsontherun.com/videos/lWMJeVvV-364767.mp4',
        width: '640',
        height: '360'
    });



    function play() {
        jwplayer().play();
        document.getElementById('play').style.display = 'none';
        document.getElementById('pause').style.display = 'inline-block';
    }
    function pause() {
        jwplayer().pause();
        document.getElementById('pause').style.display = 'none';
        document.getElementById('play').style.display = 'inline-block';
    }
</script>

Thank you

 Here is the  [DEMO LINK][1]`http://jsfiddle.net/hiteshbhilai2010/f6ufe/17/`
2

2 Answers

1
votes

Thanks

I am truly new to jsfiddle

I am not sure why but the function in JS portion are not working

so I put those in html page using script tag and now it is working

 can some one tell why is that so ....i have included my link which is  not working link 

 http://jsfiddle.net/hiteshbhilai2010/f6ufe/17/

 this is my link for new code which is working
** http://jsfiddle.net/hiteshbhilai2010/f6ufe/30/**

thanks for help ..:)

0
votes

I just went to both jsfille links and they both work fine for me?