Jump to content

Javascript Function not working...


ajhanna88

Recommended Posts

Hi guys,

 

I am trying to use a function that accepts two parameters the name (id of the div) and the video file path (filename) to avoid duplicating code 5 times for each video which does the exact same thing, however it is not loading the video. I have checked my error console on firebug and I am receiving no errors on the page, is what I am trying to achieve possible, or am I calling the code in the wrong place? Thanks

<script>
		$(document).ready(function(){
		
            playVideo('video_01', '/video/video1.mp4');
            playVideo('video_02', '/video/video2.mp4');
            playVideo('video_03', '/video/video3.mp4');
            playVideo('video_04', '/video/video4.mp4');
            playVideo('video_05', '/video/video5.mp4');

            function playVideo(name, filename) {
                jwplayer(name).setup({
                    file: filename,
                    controls: true,
                    width: 680,
                    height: 498,
                    autostart: false,
                    //repeat: "always",
                    stretching:"fill",
                    backcolor: 'FFFFFF',
                    smoothing: 'false',
                    startparam: 0,
                    events: {
                        onPause: function(event) {
                            jwplayer(name).play();
                        },
                        onSeek: function(event) {
                            jwplayer(name).play();
                        }
                    }
                });
                $(window).resize(function(){
                    var vidsizes = getEraVidSizes();
                    jwplayer().resize(vidsizes.width,vidsizes.height);
                });
            }

		});
	</script>
Link to comment
https://forums.phpfreaks.com/topic/287317-javascript-function-not-working/
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.