Introduction
This article tries demostrate the power of the MediaElement and the MediaStreamSource class that is available to Developers. In this article we shall try to write some code to play an avi video located locally on your computer.
Background
With the new features introduced into Silverlight 4, I had wanted to try and write a simple Application to play an AVI video file. To do this I had to sacrifice quite some time to do research on the subject. Initially I played around with the WriteableBitmap but later discovered the powerful capabilities and features provided by the MediaStreamSource Class.
This article barely touches the surface of those capabilities provided by the MediaStreamSource Class to developers. This article therefore does not delve into decoding video files, it only demonstrates how to buffer samples and provide them to MediaElement control using a custom class derived from MediaStreamSource class. The decoding is handled by a dll (AVIDll.dll) which is also included in the sample which we shall use to return video samples as byte array. The source of this dll is not included in this article. It is only a simple wrapper for the methods using P/Invoke and was written in VB6 as an ActiveX dll. There are a good number of articles out there including some from codeproject that deal with opening avi files (using avifil32.dll and other dlls) such as http://www.codeproject.com/KB/audio-video/avifilewrapper.aspx and a very old yet still very useful website http://www.shrinkwrapvb.com/avihelp/avihelp.htm
In our sample code, we need to first derive our custom class from System.Windows.Media.MediaStreamSource. This will require us to override a number of methods. Without going into too much detail the methods are OpenMediaAsync, GetSampleAsync, CloseMedia, SeekAsync, GetDiagnosticsAsync and SwitchMediaStreamAsync. I will not dig deep into defining these methods but the ones we shall use in our example code are:
OpenMediaAsync: We override this method and an in it we initialize and report some metadata about the media by calling ReportOpenMediaCompleted() method.
GetSampleAsync: We override this method and retrieve the next requested Sample by the MediaElement. MediaElement will call this method every time it needs a Sample. To report back to MediaElement that the Sample is ready, we call ReportGetSampleCompleted() method.
Some good books to read on the subject include 'Silverlight 4 in Action' and 'Silverlight Recipes - A problem Solution Approach'.
Our main objective in this article is to write a simple Silverlight Application that plays back an avi video. Well, for the video (.avi) to play you must have the relevant codec on your machine first.
Read more: Codeproject
27 comments:
wqju longchamp bags FgyPbn 8529
longchamp outlet yeqh http://www.longchampbagspurse.com/ longchamp outlet
Wkggd rhauwf longchamp handbags 9472
longchamp outlet mtyk http://www.longchamphandbagsusa.com/ longchamp outlet
zowt longchamp sale CjoRo paris f 3200
longchamp outlet yncj http://www.longchampsalepurse.com/ longchamp outlet
Mhmpc bwburj longchamp le pliage weo3336
longchamp outlet byem http://www.longchamplepliageus.com/ longchamp outlet
Okywk longchamp zmeett
Bem longchamp outlet pr amp longchamp paris uns
Virbo longchamp uhzf long champ ru longchamp sale lncsof
Drn longchamp outlet wf akw longchamp paris jbr
Frc longchamp le pliage to longchamp msv longchamp le pliage ebb
Sgg longchamp outlet dv df longchamp bags i longchamp paris fqt
http://www.agentnetblog.com/membership/members/usamax321/activity/974
http://www.mailassist.info/node/4598
http://smart.13ill.com/blog/view/90102/wwwlongchamppursepariscom-52110
http://authoringbooks.com/members/usajttpys/activity/176997
http://www.healthcarespec.com/forum/topic/wwwlongchamppursepariscom-2673?replies=1#post-14981
http://forum.jamaicanrastafarianlove.com/topic.php?id=94242#post-97087
http://www.nooidea.com/discussions/everything-mac/wwwlongchamppursepariscom-1290#post-11513
http://meetuniversitygirls.com/members/usaqszbei/activity/650888
http://okki.pl/index.php?do=/popcroxxx/blog/www-longchamppurseparis-com-175/
http://dantain.com/read_blog/191580/www.longchamppurseparis.com-190
http://expat.savagenet.com/bbpress/topic/26536?replies=0#post-26555
http://www.askyaya.org/forum/topic/Omega-Omega-horloges-Replica-Omega-horloges-nep-2012-11-27.htm#topic/Omega-Omega-horloges-Replica-Omega-horloges-nep-2012-11-27.htm
http://www.pontaccio.org/support/topic/wwwlongchamppursepariscom-521115#post-34899
http://discussitall.net/groups/www-longchampbagspurse-com-dl2899/
http://bbs.sunpanel.cc/topic.php?id=22731#post-22859
http://youthsd.com/members/usa321/activity/
http://startbreakdancing.com/member-list/usanajcii/activity/36246
http://newjerseytopbartender.com/members-2/usappredftg/activity/6113
http://test.risecorp.com/members-2/usalqsoyr/activity/22923
http://forum.sixvirtues.com/topic/wwwlongchampbagspursecom-dl3091#post-41482
4bSji ghd hair straighteners
aOrn cheap ugg boots
jNuq michael kors purses
9aIxd GHD
9xHeu burberry sale
6gScw bottes ugg pas cher
3hEpp ghd hair straighteners
5tYwr louis vuitton outlet
8bSdj michael kors handbags
8mYwp ghd hair straightener
6aLjq ugg uk
3gJxx nfl football jerseys
7wKpy michael kors purses
4jBxa lisseur ghd pas cher
6rNtj ugg boots
oEip ghd straightener
jVvz ugg boots
eCth michael kors outlet
8wSee cheap uggs
8rKgz chi hair products
7nWcc michael kors bags
9nYjt cheap nfl jerseys
3rLwx ghd hair straighteners
2lKht north face jackets
9hLog comprar ugg online
9pBds ghd salon styler
3bUel michael kors outlet
6uCex nfl shop
4nPen ghd
0pCwj ugg store
xanax online xanax 2mg xr - do people buy xanax online
buy cheap tramadol tramadol 50 mg oral tablet - 350 mg tramadol high
generic xanax xanax side effects men - buy cheap generic xanax online
xanax online white oval 2mg xanax - buy xanax online with paypal or money order
order tramadol online cod order tramadol without - can u overdose tramadol
buy tramadol online tramadol hydrochloride 100 mg - tramadol 93 58 side effects
xanax without a perscription can take 2mg xanax - generic xanax dava
buy tramadol online tramadol hcl capsules 50mg - tramadol hcl 50 mg get high
xanax alprazolam 4mg xanax and alcohol - xanax 901
buy carisoprodol cheap carisoprodol 350 mg maximum dosage - carisoprodol side effects alcohol
generic tramadol tramadol extended release generic - tramadol 50mg dosage for humans
buy cialis cheap online buy cheap cialis australia - generic cialis mail order
cialis online generic cialis lowest price - cialis 20 mg
buy tramadol online tramadol lethal dose - long develop tramadol addiction
http://buytramadolonlinecool.com/#30807 buy-tramadol-online.org - tramadol 100mg buzz
http://buytramadolonlinecool.com/#96430 tramadol 50 mg long does last - tramadol 50 mg drug interactions
buy tramadol buy tramadol online for cheap - cheap tramadol eu
buy tramadol without a script tramadol dosage recreational - tramadol 50mg what is it for
buy tramadol tramadol online forum - tramadol hcl 50 mg snort
buy tramadol online high on tramadol - tramadol ultram 50mg
xanax online pharmacy xanax bars 2090 - xanax side effects urinary retention
http://bayshorechryslerjeep.com/#2mg home remedies xanax overdose - xanax xr 1 mg twice a day
I am extremely impressed together with your writing skills and also with the format for your blog.
Is this a paid theme or did you modify it your self? Either way stay up the nice high quality
writing, it's uncommon to peer a nice blog like this one today..
my homepage - tao of badass
Post a Comment