How do you databind items in a Media Player playlist?

12 posts, 0 answers
  1. Christos
    Christos avatar
    2 posts
    Member since:
    Jun 2010

    Posted 05 Mar 2014 Link to this post

    Hi,

    My requirement is to databind the media player playlist in code behind. However, when I try to populate the playlist from the code behind, I don't get anything in the playlist but only the first video plays. Can you please help?

    What I currently do is:

    In the aspx page:

    <telerik:RadMediaPlayer ID="RadMediaPlayer1" runat="server" Height="554px" Width="692px">
    <PlaylistSettings Mode="Buttons" ButtonsTrigger="Hover" />
    </telerik:RadMediaPlayer>

    And in the aspx.vb page:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

    RadMediaPlayer1.ToolBar.HDButton.Visible = False
    RadMediaPlayer1.TitleBar.ShareButton.Visible = False

    Dim table As DataTable = GetDataTable("SELECT * From Mytable", MyConnString)

    For Each row As DataRow In table.Rows
    Dim myfilename As String = row("myFilename") 'Mp4 file
    Dim mytitle As String = row("mytitle")

    Dim file As New MediaPlayerVideoFile() With {.Title = mytitle, .Poster = "poster.png"}
    file.Sources.Add(New MediaPlayerSource() With {.Path = myfilename)})
    RadMediaPlayer1.Playlist.Add(file)
    Next

    End Sub

    Friend Shared Function GetDataTable(ByVal query As String, ByVal myConn As String) As DataTable

    Dim connString As String = ConfigurationManager.ConnectionStrings(myConn).ConnectionString
    Dim conn As SqlConnection = New SqlConnection(connString)
    Dim myadapter As SqlDataAdapter = New SqlDataAdapter
    myadapter.SelectCommand = New SqlCommand(query, conn)
    Dim table As New DataTable
    conn.Open()
    Try
    myadapter.Fill(table)
    Catch ex As Exception
    Finally
    conn.Close()
    End Try
    Return table
    End Function
  2. Eyup
    Admin
    Eyup avatar
    3014 posts

    Posted 10 Mar 2014 Link to this post

    Hi Christos,

    I've already replied in your ticket 794994. We will prepare the sample project as promised and send it to you when ready.

    Regards,
    Eyup
    Telerik

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Christos
    Christos avatar
    2 posts
    Member since:
    Jun 2010

    Posted 10 Mar 2014 in reply to Eyup Link to this post

    Thanks Eyup,

    I first posted here and then opened a ticket to speed it up. You can remove the post if you prefer.

    I will be waiting for your sample project.

    Many thanks,

    Christos
  5. Daniel Aquere
    Daniel Aquere avatar
    85 posts
    Member since:
    Mar 2011

    Posted 10 Apr 2014 Link to this post

    Hi Eyup / Christos,

    Please, could you share the sample?

    I have the same problem.

    Thanks.

    Daniel
  6. Eyup
    Admin
    Eyup avatar
    3014 posts

    Posted 15 Apr 2014 Link to this post

    Hello Daniel,

    I'm attaching the mentioned sample as requested. I hope it will prove helpful.

    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.

     
  7. Markus
    Markus avatar
    205 posts
    Member since:
    Nov 2005

    Posted 07 May 2014 in reply to Eyup Link to this post

    Dear Eyup

    I am evalutating RadMediaPlayer to pull videos (1-n) from Sitefinity Dynamic Modules and have some questions you might easily can answer.

    I did have a look at your example and would like to know:

    1) How do you add multiple videos to a playlist
        1a) all having 3 formats 

    2) is it possible to auto loop videos.
     2a) if only one play endless
     2b) if multiple play 1 -> 2 -> 3 -> 1

    3) Default seems to be that controls show and if not used fade out
      3a) I could hide them with player.ToolBar.Visible = false; but is there a way to have it perform the other way around. Initially hidden and on mouse over shown

    4) I would like the same with top bar. See screen shot. I  would like to have that hidden and shown on mouse over with the playlist closed.

    5) Can it be that I am missing the API Reference for the RadMediaPlayer here: http://www.telerik.com/help/aspnet-ajax/n_telerik_web_ui_menu.html


    Thanks for your help in advance.

    Markus
  8. Markus
    Markus avatar
    205 posts
    Member since:
    Nov 2005

    Posted 08 May 2014 in reply to Markus Link to this post

    Dear Eyup

    Here is what I got so far: 
    http://staging.bskd.ch.mserver5.arvixevps.com/test

    What I now need:
    1) Hide the playlist initially
    2) Have the videos play one after the other

    Problem/Bug:
    1) When you hide the toolbar the playlist and titlebar (hide/show playlist) do not work.

    Markus
  9. Markus
    Markus avatar
    205 posts
    Member since:
    Nov 2005

    Posted 09 May 2014 in reply to Markus Link to this post

    Well I found out that I can use CSS to do a lot of thing.

    What I have not solved yet is:
    2) is it possible to auto loop videos.
     2a) if only one play endless
     2b) if multiple play 1 -> 2 -> 3 -> 1

    Markus
  10. Eyup
    Admin
    Eyup avatar
    3014 posts

    Posted 12 May 2014 Link to this post

    Hi Markus,

    I've modified the sample to demonstrate how you can achieve requirements 1,2,3 and 4 although I couldn't find any attached images. As for point 5, you can find the main classes for every control in the Telerik.Web.UI Namespace:
    http://www.telerik.com/help/aspnet-ajax/t_telerik_web_ui_mediaplayervideofile.html

    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.

     
  11. Markus
    Markus avatar
    205 posts
    Member since:
    Nov 2005

    Posted 13 May 2014 in reply to Eyup Link to this post

    Dear Eyup

    Once again outstanding. Exactely what I needed. You would get 105 points out of 100 possible.

    People like you make Telerik so special. 

    Once again thanks a whole heap.

    Markus
  12. Arnaud
    Arnaud avatar
    7 posts
    Member since:
    Feb 2015

    Posted 09 Mar 2015 Link to this post

    We could say it's outstanding if it was in documentation (its real place) and not in a file in one thread of the forum...

    As it is a server control, populating it server side should be in documentation...
  13. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 12 Mar 2015 Link to this post

    Hello Arnaud,

    I agree with you that Programmatic Creation article should be added in the documentation. I have already contacted the team responsible for RadMediaPlayer control and they confirmed that such an article will be created as soon as possible. Please excuse us for the inconvenience caused.

    Regards,
    Pavlina
    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017