Initializing Youtube PL code behind

2 posts, 0 answers
  1. Arnaud
    Arnaud avatar
    7 posts
    Member since:
    Feb 2015

    Posted 13 Mar 2015 Link to this post


    I am working code-behind and have a condition.

    If Ok => read a playlist
    if NotOK => read a single video

     if (myCondition)
                    RadMediaPlayer1.Sources.Add(new MediaPlayerSource() { Path = "" });
                    RadMediaPlayer1.PlaylistSettings.YouTubePlaylist = MyYoutubePL;
                    RadMediaPlayer1.PlaylistSettings.Position = MediaPlayerPlaylistPosition.Horizontal;
                    RadMediaPlayer1.PlaylistSettings.Mode = MediaPlayerPlaylistMode.Buttons;
                    RadMediaPlayer1.PlaylistSettings.ButtonsTrigger = MediaPlayerScrollButtonsTrigger.Hover;

    When myCondition is true, all works perfecly, the single video file is attached to the player

    but if myCondition is false : nothing happens, I can't see any Playlist or video...

    Any idea ?
  2. Eyup
    Eyup avatar
    3590 posts

    Posted 18 Mar 2015 Link to this post

    Hi Arnaud,

    Can you please verify whether you are configuring the player sources during the Page_init event handler of the player?

    The best solution in your scenario would be to define declaratively two RadMediaPlayers - one with single source and the other one with Playlist. Then, depending on some user interaction or selection you can hide one of them using its Visible property.

    Hope this helps.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top