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

RadMediaPlayer using MediaPlayerAudioFile and MediaPlayerVideoFile concurrent

2 Answers 133 Views
MediaPlayer
This is a migrated thread and some comments may be shown as answers.
Hasan
Top achievements
Rank 1
Hasan asked on 28 May 2014, 07:00 AM
i use RadMediaPlayer in my project and i want in playlist add both audio and video. my code is: SqlConnection con = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["conection"].ConnectionString);
SqlCommand cmd = new SqlCommand("SELECT Extension,Detail,Link,Title,Folder,Pic FROM [TblQuality] WHERE mId=@mId", con);
cmd.Parameters.AddWithValue("@mId", QSi);
SqlDataReader dr;
MediaPlayerFile file;
using (con)
{
con.Open();
dr = cmd.ExecuteReader();
while (dr.Read())
{
if (!dr.GetString(2).ToLower().EndsWith(".rar") || !dr.GetString(2).ToLower().EndsWith(".zip"))
{
//new media
if (dr.GetString(2).ToLower().EndsWith(".mp3"))
{
file = new MediaPlayerAudioFile()
{
Poster = string.Format("~/Management/images/Music_img/{0}/{1}", dr.GetString(4), dr.GetString(5)),
Path = string.Format("~/Cnt/Music/{0}/{1}", dr.GetString(4), dr.GetString(2)),
Title = string.Format("{0}.{1} - {2}", dr.GetString(3), dr.GetString(0), dr.GetString(1))
};
RadMP1MusicDown.Playlist.Add(file);
}
else
{
file = new MediaPlayerVideoFile()
{
Poster = string.Format("~/Management/images/Music_img/{0}/{1}", dr.GetString(4), dr.GetString(5)),
Path = string.Format("~/Cnt/Music/{0}/{1}", dr.GetString(4), dr.GetString(2)),
Title = string.Format("{0}.{1} - {2}", dr.GetString(3), dr.GetString(0), dr.GetString(1))
};
RadMP1MusicDown.Playlist.Add(file);
}
}
}
dr.Close();
cmd.Cancel();
}but when load page, media play are only in audio mode or video mode.if first item is mp3 and second is mp4 when video play mediaplayer don't show video only play sound.can help me fix this?
-------------------------------------
hgh system MediaSpace

2 Answers, 1 is accepted

Sort by
0
Hasan
Top achievements
Rank 1
answered on 31 May 2014, 09:07 AM
hi every one.no body can't help me.this is easy, think i have a programmatic media player that in playlist has both audio and video.i want when mediaplayer play audio being in audio mode and when pla video be in video mode.
my code like this:
            SqlConnection con = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["HGHDB"].ConnectionString);
            SqlCommand cmd = new SqlCommand("SELECT Extension,Detail,Link,Title,Folder,Pic FROM [TblQuality] WHERE mId=@mId", con);
            cmd.Parameters.AddWithValue("@mId", QSi);
            SqlDataReader dr;
            MediaPlayerFile file;
            using (con)
            {
                con.Open();
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    if (!dr.GetString(2).ToLower().EndsWith(".rar") || !dr.GetString(2).ToLower().EndsWith(".zip"))
                    {
                        //new media
                        if (dr.GetString(2).ToLower().EndsWith(".mp3"))
                        {
                            file = new MediaPlayerVideoFile()
                            {
                                Poster = string.Format("~/Management/images/Music_img/{0}/{1}", dr.GetString(4), dr.GetString(5)),
                                Path = string.Format("~/Cnt/Music/{0}/{1}", dr.GetString(4), dr.GetString(2)),
                                Title = string.Format("{0}.{1} - {2}", dr.GetString(3), dr.GetString(0), dr.GetString(1))
                            };
                            RadMP1MusicDown.Playlist.Add(file);
                            MusicName = dr.GetString(3);
                        }
                    }
                }
            }
-------------------------------------
hgh system MediaSpace






0
Konstantin Dikov
Telerik team
answered on 02 Jun 2014, 12:40 PM
Hello Hasan,

When a combination of Video and Audio files is used within one Playlist, only the first type will be taken into account, which will lead to the behavior that you are describing. 

With the current implementation of the control it is not possible to have a mixed playlist (containing video and audio files) and you must have a separate playlists for each type (as demonstrated in our online demo MediaPlayer - Media Types).

Nevertheless, if you think that such functionality would be a good addition to the control, you could create an item in our Ideas & Feedback Portal and if it receives enough votes, our developers team will consider implementing it in one of our future releases.


Regards,
Konstantin Dikov
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
Hasan
Top achievements
Rank 1
Answers by
Hasan
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or