admin管理员组

文章数量:1400157

I am setting up a jwPlayer stream with this video:

Because the file is hosted on that website I have to embed it using their infrastructure (with an xml playlist and their own jwPlayer, version 5.7).

I've got everything working except a continuous repeat. The 'repeat: always' option doesn't work. The onComplete event doesn't fire either. This is the code, which is almost similar to their own embed code: .html

The onTime event does work for repeat on my pc (mented out in the code). But alas it doesn't seem to fire on the pc where this app needs to be installed. For debugging I added the controlbar and playlist to the player.

<html>
<head>
    <title>NMB Video</title>
    <link rel="stylesheet" href="assets/nmb_video.css">
    <script type="text/javascript" src="assets/jquery.js"></script>
    <script type='text/javascript' src='.js'></script>
    <script type="text/javascript" src=".js"></script>


<script type='text/javascript'>

$(function() {
    loadAAPIVideoUrl("20101210_dino01",function(streamid,streamurl){
        jwplayer("stvbb3054251").setup({
            link:"",
            width: 800,
            height: 500,
            image: ".jpg",
            file: streamurl,
            modes: [
                {type: "flash",
                  src: ".swf",
                  config:{
                      provider: ".swf"
                  }
                },
                {type: "html5"
                }
            ],
            title:'Dinosaurus op de vlucht',
            author:'NTR',
            date:'17-01-2011',
            description:'Timo de T-rex wil een ei eten. Dat is niet zonder gevaar.',
            controlbar: 'top',
            'playlist.position': 'top',
            image:'.jpg',

            repeat: 'always',
            dock: false,
            autostart: true,
            fullscreen:true,

            events: {
            /*
                onTime: function(event) {
                    if (event.position > 280) { 
                    alert('time!'); jwplayer().seek(0).play(true); }
                },
                */
                onComplete: function() {
                    alert('plete');
                    jwplayer().seek(0).play(true);
                }
            }
        });
    });
});

</script>

</head>
<body style="overflow: hidden;">
<!--
<div id="standby">
    <h1><span>SchoolTV: Timo de T-Rex</span><br>Raak het scherm aan om de film te bekijken.</h1>
</div>
-->
<div class="player flash schooltv_beeldbank mediaplayer">
  <div id="ivpd3054251" class="ivplayerdata" style="display:none;"></div>
  <video id="stvbb3054251" controls width="348" height="178" poster=".jpg">
  </video>
</div>
</body>
</html>

I am setting up a jwPlayer stream with this video: http://www.schooltv.nl/beeldbank/clip/20101210_dino01

Because the file is hosted on that website I have to embed it using their infrastructure (with an xml playlist and their own jwPlayer, version 5.7).

I've got everything working except a continuous repeat. The 'repeat: always' option doesn't work. The onComplete event doesn't fire either. This is the code, which is almost similar to their own embed code: http://dev.jasperheeffer.nl/dinovid/schooltv_new.html

The onTime event does work for repeat on my pc (mented out in the code). But alas it doesn't seem to fire on the pc where this app needs to be installed. For debugging I added the controlbar and playlist to the player.

<html>
<head>
    <title>NMB Video</title>
    <link rel="stylesheet" href="assets/nmb_video.css">
    <script type="text/javascript" src="assets/jquery.js"></script>
    <script type='text/javascript' src='http://www.schooltv.nl/beeldbank/shared/applications/jwplayer/js/jwplayer.js'></script>
    <script type="text/javascript" src="http://www.ntr.nl/static/js/loadAAPIVideo.js"></script>


<script type='text/javascript'>

$(function() {
    loadAAPIVideoUrl("20101210_dino01",function(streamid,streamurl){
        jwplayer("stvbb3054251").setup({
            link:"http://www.schooltv.nl/beeldbank/clip/20101210_dino01",
            width: 800,
            height: 500,
            image: "http://www.schooltv.nl/beeldbank/mmbase/images/3683800/20101210_dino01.jpg",
            file: streamurl,
            modes: [
                {type: "flash",
                  src: "http://www.schooltv.nl/beeldbank/shared/applications/jwplayer/swf/NTRPlayer.swf",
                  config:{
                      provider: "http://www.schooltv.nl/beeldbank/shared/applications/jwplayer/swf/adaptiveProvider.swf"
                  }
                },
                {type: "html5"
                }
            ],
            title:'Dinosaurus op de vlucht',
            author:'NTR',
            date:'17-01-2011',
            description:'Timo de T-rex wil een ei eten. Dat is niet zonder gevaar.',
            controlbar: 'top',
            'playlist.position': 'top',
            image:'http://www.schooltv.nl/beeldbank/mmbase/images/3683801/20101210_dino01.jpg',

            repeat: 'always',
            dock: false,
            autostart: true,
            fullscreen:true,

            events: {
            /*
                onTime: function(event) {
                    if (event.position > 280) { 
                    alert('time!'); jwplayer().seek(0).play(true); }
                },
                */
                onComplete: function() {
                    alert('plete');
                    jwplayer().seek(0).play(true);
                }
            }
        });
    });
});

</script>

</head>
<body style="overflow: hidden;">
<!--
<div id="standby">
    <h1><span>SchoolTV: Timo de T-Rex</span><br>Raak het scherm aan om de film te bekijken.</h1>
</div>
-->
<div class="player flash schooltv_beeldbank mediaplayer">
  <div id="ivpd3054251" class="ivplayerdata" style="display:none;"></div>
  <video id="stvbb3054251" controls width="348" height="178" poster="http://www.schooltv.nl/beeldbank/mmbase/images/3683800/20101210_dino01.jpg">
  </video>
</div>
</body>
</html>
Share Improve this question asked Jan 24, 2013 at 18:21 J.H.J.H. 1642 silver badges10 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

I am not sure why it isn't firing here.

Here is a very stripped down example that you can simply copy/paste though, which does fire:

<html>
<head>
<title>Test Page</title>
</head>
<body>
<script type="text/javascript" src="http://player.longtailvideo./jwplayer.js"></script>
<div id="player"></div>
<script type="text/javascript">
    jwplayer("player").setup({
            file: "http://www.longtailvideo./jw/upload/bunny.mp4",
            flashplayer: "http://player.longtailvideo./player.swf",
            width: 465,
            height: 300,
            events:{
            onComplete: function() {
                alert("hi!");
                }
            }
    });
</script>
</body>
</html>

本文标签: javascriptjwPlayer onComplete event not firing (crossdomain embed)Stack Overflow