Jump to content

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...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.