Jump to content

video playlist duplicating first video and not playing next video


jvanasco

Recommended Posts

Hey all, my friend is using jwplayer, an older version and he has a playlist of videos that are supposed to play one after another however, for some reason its not working. I did notice that after running this code and viewing the source of the page that the 1st video seems to be listed twice and I am not sure why. I looked in the DB and anything related to the 1st video is only listed once. Any help would very much be appreciated. I am not totally familiar with PHP, I am still learning. I know enough to fix some things but this one has me really stumped. It seems like the issue is stemming from the 1st level section of the play list because the foreach function after that lists all of the videos correctly but it also includes the 1st video. If I remove the 1st level section the video player stops working.

<div id="piano_gal_heading" align="center">Sonny's Piano TV Show Library </div>
<style type="text/css">
    #show_page {
        width: 800px;
        margin: auto;
    }
    #testimonials_heading {
        font-size: 24px;
        text-decoration: underline;
        font-variant: small-caps;
        font-weight: 800;
        letter-spacing: 10px;
        color: #1F3751;
        padding-top: 5px;
        padding-bottom: 5px;
        text-align:center;
    }

    #left_img {
        background-image:url('/images/bg_left_testimonials.jpg');
        background-position:left;
        background-repeat:repeat-y;
    }

    #right_img {
        background-image:url('/images/bg_right_testimonials.jpg');
        background-position:right;
        background-repeat:repeat-y;
    }

    .tv_show {
        background-color:#CFDBE6;
        margin-top:10px;
        padding:20px;
        min-height:160px;
    }

    .tv_show_img {
        margin-right:20px;
    }

    a.show_title:link {
        font-family: arial, sans serif;
        font-size: 1.1em;
        font-weight: 600;
        font-variant: small-caps;
        text-decoration: underline;
        font-style: normal;
        text-shadow: 1px 1px #333;
        color: #B50000;
    }

    a.show_title:visited {
        font-family: arial, sans serif;
        font-size: 1.1em;
        font-weight: 600;
        font-variant: small-caps;
        text-decoration: underline;
        font-style: normal;
        text-shadow: 1px 1px #333;
        color: #B50000;
    }
    a.show_title:hover {
        font-family: arial, sans serif;
        font-size: 1.1em;
        font-weight: 600;
        font-variant: small-caps;
        text-decoration: underline;
        font-style: normal;
        text-shadow: 1px 1px #333;
        color: #B50000;
    }
    
    a.show_title:active {
        font-family: arial, sans serif;
        font-size: 1.1em;
        font-weight: 600;
        font-variant: small-caps;
        text-decoration: underline;
        font-style: normal;
        text-shadow: 1px 1px #eee;
        color: #B50000;
    }

    a.whitelink:link { color: #FFFFFF; }
    a.whitelink:active { color: #CC0000; }
    a.whitelink:visited { color: FFFFFF; }
    a.whitelink:hover { color: #CC0000; }

    a.sp_link:link {
        color: #CC0000;
        font-style: italic;
        font-weight: 900;
    }
    a.sp_link:active {
        color: #FFFFFF;
        font-style: italic;
        font-weight: 900;
    }
    a.sp_link:visited {
        color: #CC0000;
        font-style: italic;
        font-weight: 900;
    }
    a.sp_link:hover {
        color: #990000;
        font-weight: 900;
        font-style: italic;
        background-color: #FFFFFF;
    }
    /*#main_content_wrapper {
            width:100%;
    }*/
</style>
<div id="show_page">
    <div class="page_title">
        <!--<h1 id="testimonials_heading">Sonny's Piano TV Show Library</h1>-->
        <h3>Here you can see the full length versions of all of Sonny's Piano TV Shows.</h3>
        <?php
            if ($current_piano != NULL) {
                echo '<h2>#'.$current_piano->show_number.' : '.$current_piano->show_name.'</h2>';
            }
        ?>
    </div>
    <div align="center" id="flv">
        <?php if (strpos(strtolower($play_flv), '.jpg.flv') !== FALSE) : ?>
            <img style="width:100%;" src="<?php echo str_replace('.flv', '', $play_flv); ?>" alt="<?php echo $current_piano->show_name; ?>" >
        <?php else : ?>
            <div id="jw_gallery">Loading the player ...</div>
            <script type="text/javascript">
                var titles = new Array();
                
                <?php foreach ($playlist as $vid) : ?>
                    titles.push("<?php echo str_replace('"', '', $vid['title']); ?>");
                <?php endforeach; ?>
                var playlist = [
                    {
                        levels: [
                            {
                                file: "<?php echo $play_flv; ?>"
                            }
                        ]
                    }
                    <?php foreach ($playlist as $vid) : ?>
                        , {     
                            levels: [
                                {
                                    file: "<?php echo $vid['flv']; ?>"
                                }
                            ]
                        }
                    <?php endforeach; ?>
                ]; 
                jwplayer("jw_gallery").setup({
                    autoplay: true,
                    repeat: "list",
                    height: 470,
                    width: 800,
                    flashplayer:"<?php echo site_url(); ?>js/jwplayer/player.swf",
                    playlist: playlist

                }).play().onPlaylistItem(function(e) {
                    $('#featured_title').html(titles[e.index]);
                });
             
            </script>
        <?php endif; ?>
    </div>
    <div>
        <p id="featured_title" align="center">
            <?php
                if ($current_piano != NULL) {
                    echo $current_piano->show_name;
                }
            ?>
        </p>
    </div>
    <center>
        <div style="clear: both;"></div>

        <p style="smallprint">Click on the media box above to stop the video or Click on the right arrow button to watch the next video </p>
        <div style="padding-right: 16px; padding-left: 16px; padding-top: 12px; padding-bottom: 10px;">
            <?php echo isset($current_piano->show_desc) ? $current_piano->show_desc : ''; ?>
        </div>
    </center>
    <?php foreach ($tvshows as $key => $piano) : ?>
        <?php
            $thumb = SHOW_THUMB_PATH . 'show ' . $piano->show_number . '.jpg';
            $thumb = (file_exists(SITE_PATH . $thumb)) ? base_url() . $thumb : base_url() . SHOW_THUMB_PATH . $piano->show_thumb;
        ?>
        <div class="tv_show">
            <div>
                <a href="<?php echo site_url().'piano-tv-show/'.$piano->show_id; ?>"><img width="286" border="0" align="left" alt="Sonny's PianoTV Show <?php echo $piano->show_number; ?>" src="<?php echo $thumb; ?>" class="tv_show_img"></a>
            </div>
            <font face="Verdana, Arial" size="-1"><b><a href="<?php echo site_url().'piano-tv-show/'.$piano->show_id; ?>" class="show_title"><?php echo $piano->show_name; ?></a></b><br><?php echo $piano->show_desc; ?> </font>
        </div>
    <?php endforeach; ?>
</div>

Edited by jvanasco
Link to comment
Share on other sites

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.