Use Ssme to reproduce the big Buck Bunny player in SILVERLIGHT3

Source: Internet
Author: User
Tags silverlight

In the previous lecture (using Smoothstreamingmediaelement in Silverlight to create a smooth streaming player I've explained in detail how to use the Smoothstreamingmediaelement (SSME) control in Silverlight3 to write a player that supports Smooth streaming video streaming, as you can see, the player is very primitive, In addition to no bright appearance, function is also very simple, of course, you can continue to add some control elements in the interface to enrich the player's functions, such as forward, back, left and right channels, full-screen and so on, in fact, these functions of the ordinary MediaElement control has been fully supported, You just have to write a simple logic to control on the OK, and relatively simple. The focus of this article is not how to add these features, but how to implement the floating panels in the big Buck Bunny player's real-time tracking smooth streaming video stream playback status, and here are the effects we want to emulate:

You can see that there are three floating panels on the player, showing the frame rate, bit rate, and the bit rate when video playback is available. We have learned the principle of smooth streaming technology, which can dynamically transmit different quality video according to the bandwidth requested by the client, when the network is in good condition, the quality of video playback is high, the quality of the video playback is poor when the status is poor, thus ensuring the fluency of video playback. The official website contains information on smooth streaming technology, and you can find some of the Ssme controls on MSDN, and you'll need to download the smooth streaming SDK before you start. These steps I have described in the previous two articles, interested readers can refer to.

Http://www.cnblogs.com/jaxu/archive/2010/01/08/1642143.html

Http://www.cnblogs.com/jaxu/archive/2010/01/21/1653314.html

The SDK contains content that is only suitable for demo, does not contain the source code of the sample player, if you plan to refactor the player, you can only imitate it yourself, but in fact we have some shortcuts to go. Remember the reflector decompile tool I introduced to you in the previous article? Inside the Silverlightbrowser plugin, we can decompile the sample player in the SDK to see how it implements the three floating panels.

After studying the decompile code, we found that the frame rate and bit rate tracking panel are actually Silverlight custom controls so that we can use them directly if we introduce the corresponding DLL files in our project. The bit Rate Setup Panel, in fact, is two Silder control, through the Value_changed event to control the smooth streaming playback. The following is my decompile and after the collation of the code, you can download the first study. Parameters that are used when the client references XAP can refer to the example in SKD.

The problem here is that the Mainplayer in the code is a custom control and, in the case of decompile, it's impossible to refactor (the structure is more complex, the class is large, and the cost of refactoring is too great). In fact, this custom control is only used in ssme, in this case, we might as well replace it with Ssme, and then the code a little bit to change it. The whole code should be simple, because it's all based on the results of the decompile, and you just need to sort out some useful code. I'll give you a little explanation here.

1. Some of the required styles in MainPage.xaml and App.xaml files are added to the corresponding files in your project.

2. The layout code for the three panels in the MainPage.xaml file needs to be added to the appropriate location in your project.

3. The background code can be directly used to provide me. Includes definitions of some private member variables, updatecontrolreferences methods, Findvisualelementfrom methods, limitmaxbitrateslider_valuechanged events, ontimercompleted events, and additions to the smoothplayer_mediaopened event.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.