Events with media elements control in WCF

21 September, 2018

Related Blogs



Used to close the opened video/audio file that is being played within the media Element control  


Used to stop the playing of a video/ audio at current position  


Used  to play the video/audio file that is attached to media element  


used to stop the playing of video / audio file & Reset the position to the beginning  

Events with media element control:-


Media opened:-

This event will be fixed after loading the video/audio file into the media element control  

Media Embed:-

This event will be fixed when playing of video/audio file completes  

EG with Media Element:-

Screenshot_12 Create a new window Create a media element: select media element Go to properties window Type the file bar in source property i.e. D:\\videos\sample. Run the application & check Media element control in supported in following OS windows 7, window vistall ( service pack) Media Element Internally will take support of windows media player and to work with media element windows. Media player version should be 10,10.0 version and above ren version of windows media player will not work on media element     Customizing media element Create a new window and write the following code design the window Private void binplay_click() { Media element/. Play(): { Private void btn pause_click()   Screenshot_13   { Mediaelement 1. Powse(); } Private void btnstop_click() { media elemnt.Stop(); }Private void btn forward –click() { Media element1. Position = mediaelemnt1. Position+timespan.fromseconds(2); } Private void then backword – click() { Media element1. Position = Media Elemtn. Position – Timespan. Fromseconds(2): }  

Hider control:-

This control is used to display some numeric data and will provide increment and decrement of values by moving the slide bar left right or top/bottom  



used to set the least value from where the slides should start (0) + [Default value]  


Used to set the highest value upto where the slides control can be used or increased – 10 [default value]  

Tick frequently :-

used to set a value by which slides value can be increased / decreased when user clicks on .1 [default]  


used to set /get current position for the slides. 0 - - > [default]  


used to set the required orientation when horizontal slides is displayed like   Screenshot_14     Default event of slider control is value changer. This event will we fired when the value within slides changes  

Previous diagram:-

Private void media element 1 – media opened() { Media element.volume = slidesi-value; } private void slides 1_vakye chanes(-) { Media element1. Value= slider 1. Value; }  

Mute button:-

Private void button mute_click(--) { Media Element 1. Value =0; }


Add reference to system . windows forms names pace and write the following. Using system. Windows. Forms; private void butn open_click(-) { Open file Dialog op = new  openfile dialog(); op. filter = “wnu files|*.wmv|mpu files|*mpg| all files|*.*; OP.showdialog(); uri obj 1 = new ori(op . filemenu: media element 1. Source = Obj1; }  
About Author


Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .