0

Getting Current Index Playlist

Hi. I currently have a list of videos stored in a playlist and each video entry is displayed in a cell. May I ask how do i get the index of the video that I have selected. I tried the following codes below. playlist is a mediaplayer variable i declared globally,

CODE
var cell = new KONtx.control.GridCell({
//styles: $content.styles.main.cell, //Style information for the Grid Cell from 960x540.js
styles: {
width: this.width
},
events: {
onSelect: function () {
this.getView().controls.latest.setText(playlist.currentIndex);
});
}
}
});


Is there anything wrong with playlist.currentIndex?

by
2 Replies
  • Not sure about the rest of your code, but I would expect the "playlist" value is not scoped correctly

    CODE
    //if you set your playlist like this
    this.playlist = new KONtx.media.Playlist();


    var cell = new KONtx.control.GridCell({
    //styles: $content.styles.main.cell, //Style information for the Grid Cell from 960x540.js
    styles: {
    width: this.width
    },
    events: {
    onSelect: function () {
    this.getView().controls.latest.setText(this.getView().playlist.currentIndex);
    });
    }
    }
    });
    0
  • QUOTE (Wei loon Ang @ Mar 30 2011, 02:00 AM) <{POST_SNAPBACK}>
    Hi. I currently have a list of videos stored in a playlist and each video entry is displayed in a cell. May I ask how do i get the index of the video that I have selected. I tried the following codes below. playlist is a mediaplayer variable i declared globally,

    CODE
    var cell = new KONtx.control.GridCell({
    //styles: $content.styles.main.cell, //Style information for the Grid Cell from 960x540.js
    styles: {
    width: this.width
    },
    events: {
    onSelect: function () {
    this.getView().controls.latest.setText(playlist.currentIndex);
    });
    }
    }
    });


    Is there anything wrong with playlist.currentIndex?


    I'm not sure why you'd want to declare playlist globally as you can access it in the global mediaplayer object like
    CODE
    KONtx.mediaplayer.playlist

    currentIndex is an object. From the mediaplayer docs:

    QUOTE
    playlist.currentIndex Object

    Object with entry and stream properties. The entry property is the zero-based index of the currently selected playlist entry (if one is selected). The stream property is the zero-based index of the currently selected stream in the playlist entry (if one is selected).


    I also see a typo:
    CODE
    events: {
    onSelect: function () {
    this.getView().controls.latest.setText(playlist.currentIndex);
    }); <----------------------------what is this?
    }

    }
    0

Recent Posts

in Getting Started / Beginners - Yahoo! TV Widgets