Difference between MediaPlayer and MediaElement ?

 Posted by Ddd on 3/21/2011 | Category: WPF Interview questions | Views: 14699 | Points: 40
Answer:

MediaPlayer has no visual interface and not suitable to display videos.
It cannot be placed on the XAML designer.
It provides Media PlayBack for drawings.
We have to use VideoDrawing or DrawingContext classes for that.

example:
MediaPlayer player = new MediaPlayer();

player.Open(new Uri("c:\\intro.wmv", UriKind.Relative));

VideoDrawing aVideoDrawing = new VideoDrawing();

aVideoDrawing.Rect = new Rect(0, 0, 100, 100);

aVideoDrawing.Player = player;


player.Play();


MediaElement has got visual interface and
can easily display videos using its built in properties.
It is designed for XAML use and can be placed on the XAML
designer.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response