且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

WP7播放Smooth Streaming

更新时间:2022-10-03 14:23:21

首先Smooth Streaming是啥?

参见介绍:

 

1,安装IIS Media Services

要IIS支持Live Smooth,需要安装IIS Media Services

安装方式有两种:

  • Web Platform Installer
  • 直接下载安装包(MSI)

 

1.1,Web Platform Installer:http://www.iis.net/media

WP7播放Smooth Streaming

WP7播放Smooth Streaming

WP7播放Smooth Streaming

 

1.2,直接下载:

X86:http://www.microsoft.com/en-us/download/details.aspx?id=27956

X64:http://www.microsoft.com/en-us/download/details.aspx?id=27955

 

安装后在IIS里就能看到了

WP7播放Smooth Streaming

 

2,Expression Encoder 编码

随便找个小视频大概演示下吧,大视频一是速度慢,二是占硬盘…

WP7播放Smooth Streaming

WP7播放Smooth Streaming

WP7播放Smooth Streaming 

 

编码完生成文件:

WP7播放Smooth Streaming

 

3,部署到IIS服务器上

吧文件拷贝到服务器,由于我们不是实时视频流,所以要看 Smooth Streaming Presentations里面

WP7播放Smooth Streaming

 

可以看到已经有我们编码过的视频了

WP7播放Smooth Streaming

 

4,WP7手机访问

WP默认不支持live smooth,因此需要第三方播放组件:http://smf.codeplex.com/

另外我们还需要Smooth Streaming Client:http://www.iis.net/download/smoothclient

我们新建一个wp工程(7.1,7.0不支持额)

WP7播放Smooth Streaming

 

然后添加引用:

WP7播放Smooth Streaming

 

添加完成后:

WP7播放Smooth Streaming

 

然后在页面添加:

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" 

 

然后添加播放器和播放列表:

            <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>

 

然后我们就能在手机中观看视频了:

WP7播放Smooth Streaming

 

当然,我们也可以通过code来播放
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            strmPlayer.Playlist.Clear();
            PlaylistItem item = new PlaylistItem();
            item.MediaSource = new Uri("http://192.168.0.1/livesmooth/infotec office.ism/manifest");
            item.DeliveryMethod = DeliveryMethods.AdaptiveStreaming;
            strmPlayer.Playlist.Add(item);
            strmPlayer.Play(); 
        }

 

参考:

 

源码:


本文转自 sun8134 博客园博客,原文链接: http://www.cnblogs.com/sun8134/archive/2012/05/14/2499296.html  ,如需转载请自行联系原作者