MSDN Library
EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

How to implement video streaming for VoIP calls for Windows Phone 8

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

This topic shows you how to implement video streaming for VoIP calls. Windows Phone 8 provides the MediaStreamer class to enable video streaming. The VoipForegroundLifetimeAgent is launched and its OnLaunched() method is called when your foreground application calls Launch(). In OnLaunched(), create a new instance of the MediaStreamer class specifying an string identifying the stream in the constructor. In the XAML for your foreground application, add a MediaElement in which the video will be displayed. Set the Source property using the following Uri scheme to hook it up to your MediaStreamer: “ms-media-stream-id:MediaStreamer-[streamer ID]”.

Use MediaStreamer to stream video

  1. Create a MediaStreamer object in the OnLaunched() method of your VoipForegroundLifetimeAgent.

    protected override void OnLaunched()
    {
      MediaStreamer ms = MediaStreamerFactory.CreateMediaStreamer("123");
      string sourceRGBA = @"http://fabrikam.com/Frame_RGBA_320_240.bin";
      RAWMediaStreamSource mss = new RAWMediaStreamSource();
      mss.SetVideoStream(sourceRGBA, 320, 240, "RGBA", 30 * TimeSpan.TicksPerSecond, false);
      ms.SetSource(mss);
    }
    
  2. In your foreground app’s XAML, create a MediaElement and set the Source property using the ID you specified when creating the MediaStreamer.

    <MediaElement Source="ms-media-stream-id:MediaStreamer-123"/>
    
    

Afficher:
© 2016 Microsoft