MediaPlayer in ASP.NET Repeater

2 posts, 0 answers
  1. Juan Manuel
    Juan Manuel avatar
    1 posts
    Member since:
    Feb 2015

    Posted 16 Feb 2015 Link to this post

    Hi I'm new here and I'm currently working with ASP.NET WebForms.

    I had some issues trying to bind sources to a RadMediaPlayer that's inside a ASP Repeater:

    <asp:Repeater ID="Publicaciones" runat="server" OnItemDataBound="FormatearPublicaciones" OnItemCommand="Publicaciones_ItemCommand">
            <td><%# Eval("PublicacionId")%></td>
            <td><%# Eval("Mensaje")%></td>
            <td><asp:Image ID="PubImagen" runat="server" ClientIDMode="Static"/></td>
                <telerik:RadMediaPlayer ID="PubAV" runat="server" ClientIDMode="Static" Width="350px" Height="250px"></telerik:RadMediaPlayer>
                <%--<audio id="PubAudio" runat="server" Width="350px" Height="250px"></audio>--%>
            <br />
            <br />

    The repeater source is provided by a stored procedure which is called in code-behind and then I use the "OnItemDataBound" event of the repeater to format each ItemTemplate. I'm doing all this steps because I'm working on a social network and I want to manage different posts (images,videos,songs,etc).

    Here is the code-behind of the repeater event:  

    protected void FormatearPublicaciones(Object Sender, RepeaterItemEventArgs e)
        string filename = ((MuroEntity)e.Item.DataItem).PubMultimediaRuta;
        System.Web.UI.WebControls.Image imagenPub = e.Item.FindControl("PubImagen") as System.Web.UI.WebControls.Image;
        Telerik.Web.UI.RadMediaPlayer avPub = e.Item.FindControl("PubAV") as Telerik.Web.UI.RadMediaPlayer;
        if (((MuroEntity)e.Item.DataItem).Tipo.Equals("F"))
            var imagenURL = Autenticado.Paths.Archivos + "thumb_" + filename;
            imagenPub.ImageUrl = imagenURL;
            avPub.Visible = false;
        else if (((MuroEntity)e.Item.DataItem).Tipo.Equals("C") || ((MuroEntity)e.Item.DataItem).Tipo.Equals("V"))
            avPub.Source = Autenticado.Paths.Archivos + filename;
            imagenPub.Visible = false;
            avPub.Visible = false;
            imagenPub.Visible = false;

    The data bind of the repeater is working fine, for example the images binding is perfect but not the audio binding. You can see the player there but when you press play nothing happens, it seems like the source isn't there but i checked with the javascript console of google chrome and the source is there.

    Here is also the static class that provides the path to the project local folder where the files (images,songs,videos,etc) are stored:

    public static class Paths
        public static readonly string Archivos = "~/Archivos/" + SessionHelper.UsuarioAutenticado.Id.ToString() + "/"; // cannot change
        public static readonly string Archivos2 = "Archivos/" + SessionHelper.UsuarioAutenticado.Id.ToString() + "/";
        //public static int Total = 5; // can change because not const

    I hope you can help me.

    Thanks in advance.


  2. Eyup
    Eyup avatar
    3590 posts

    Posted 20 Feb 2015 Link to this post

    Hello John,

    Please try to use the DataBinding event handler of the player and set a hardcoded video source using the (sender as RadMediaPlayer) approach. This will give a clue whether the player will work also with a dynamic source.


    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