This is a migrated thread and some comments may be shown as answers.

Initializing Youtube PL code behind

1 Answer 49 Views
MediaPlayer
This is a migrated thread and some comments may be shown as answers.
Arnaud
Top achievements
Rank 1
Arnaud asked on 13 Mar 2015, 04:42 PM
Hi,

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 = "https://www.youtube.com/watch?v=C4gcySKN16E" });
            }
            else
            {                
                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 ?

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 18 Mar 2015, 11:16 AM
Hi Arnaud,

Can you please verify whether you are configuring the player sources during the Page_init event handler of the player?
http://www.telerik.com/support/code-library/programmatic-creation-and-configuration-of-the-media-player-control

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.

Regards,
Eyup
Telerik
 

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.

 
Tags
MediaPlayer
Asked by
Arnaud
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or