Hi,
I have a Mediaplayer control on my XAML page like below:
<CustomMediaElement:CustomMediaPlayer
x:Name="custMediaElement"
VerticalAlignment="Center"
Width="600" Height="300" Visibility="Collapsed" />
Now I am ble to set the playList by using setPlayList()
method like below:
private void setPlayList()
{
IEnumerable eLevelData = null;
eLevelData = pMainPage.GetDataFromDictonary(pMainPage.strChildFolderID);
foreach (RMSMedia folderItems in eLevelData)
{
string strmediaURL = folderItems.strMediaFileName;
if (hasExtension(strmediaURL) == "wmv" || hasExtension(strmediaURL) == "mp4" || hasExtension(strmediaURL) == "mp3" || hasExtension(strmediaURL) == "mpg")
{
PlaylistItem playListItem = new PlaylistItem();
string thumbSource = folderItems.strAlbumcoverImage;
playListItem.MediaSource = new Uri(strmediaURL, UriKind.RelativeOrAbsolute);
playListItem.Title = folderItems.strAlbumName;
if (!string.IsNullOrEmpty(thumbSource))
playListItem.ThumbSource = new Uri(thumbSource, UriKind.RelativeOrAbsolute);
playList.Items.Add(playListItem);
}
}
custMediaElement.Playlist = playList;
}
Now , I want to change the PlayListIndex of Mediaplayer, when user clicks on a listBox Item , which contains the title of all the songs.
When the user clicks on the third song title from the songs Title List the mediaPlayer should play the third song , or if the user cliks on 7th song title, the mediaPlayer should play the 7th song.
My motto is to pick up the Selected index from the listbox and assign it to the PlayList Index of mediaPlayer.
While I add a watch to playList
I am able to see , playList
, Items
, [0]
PlaylistIndex 1
playList
, Items
, [1]
PlaylistIndex 2
But While I am trying to set it from the code , the same property PlaylistIndex
seems unavailable. Please help.
Thanks, Subhen