First, what is smooth streaming?
See introduction:
- Http://www.microsoft.com/silverlight/smoothstreaming/
- Http://www.iis.net/download/SmoothStreaming
- Http://learn.iis.net/page.aspx/626/smooth-streaming-technical-overview/
1. Install IIS Media Services
To support live smooth in IIS, you must install IIS media services.
There are two installation methods:
- Web platform Installer
- Directly download the installation package (MSI)
1.1, web platform Installer: http://www.iis.net/media
1.2, direct download:
X86: http://www.microsoft.com/en-us/download/details.aspx? Id = 27956
X64: http://www.microsoft.com/en-us/download/details.aspx? Id = 27955
After installation, you can see it in IIS.
2, expression encoder Encoding
You can find a small video to demonstrate it. For large videos, the speed is slow, and the hard disk is occupied...
Encode the generated file:
3. Deploy it on the IIS server
Because we are not real-time video streams, We need to copy the streaming files to the server.
We can see that we have already encoded the video.
4. WP7 mobile access
WP does not support live smooth by default, so third-party playback components are required: http://smf.codeplex.com/
In addition, we also need the smooth streaming client: http://www.iis.net/download/smoothclient
Create a new WP Project (7.1, 7.0 not supported)
Then add reference:
After adding:
Then add the following on the page:
Xmlns: Core = "CLR-namespace: Microsoft. silverlightmediaframework. Core; Assembly = Microsoft. silverlightmediaframework. Core. Phone"
Xmlns: Media = "CLR-namespace: Microsoft. silverlightmediaframework. Core. Media; Assembly = Microsoft. silverlightmediaframework. Core. Phone"
Then add the player and playlist:
<Core: smfplayer autoplay = "false" name = "strmplayer">
<Core: smfplayer. playlist>
<Media: playlistitem deliverymethod = "adaptivestreaming" mediasource = "http: // 192.168.0.1/livesmooth/infotec office. ISM/manifest"/>
</Core: smfplayer. playlist>
</Core: smfplayer>
Then we can watch the video on our cell phone:
Of course, we can also use code to play 1 private void phoneapplicationpage_loaded (Object sender, routedeventargs E)
2 {
3 strmplayer. playlist. Clear ();
4 playlistitem item = new playlistitem ();
5 item. mediasource = new uri ("http: // 192.168.0.1/livesmooth/infotec office. ISM/manifest ");
6 item. deliverymethod = deliverymethods. adaptivestreaming;
7 strmplayer. playlist. Add (item );
8 strmplayer. Play ();
9}
Refer:
- Http://smf.codeplex.com/documentation
- Http://blogs.msdn.com/ B /giuseppeguerrasio/archive/2010/12/06/using-smooth-streaming-media-element-for-windows-phone-7.aspx
- Http://blogs.msdn.com/ B /risman/archive/2012/02/04/windows-phone-7-video-smooth-streaming-client.aspx
Source code: