title: Media & Device object or namespace could not be found
body: <p>I am fairly new to c# and am trying to write a basic program to stream video via an Onvif camera device. I am able to mostly follow and understand <a href="https://www.youtube.com/watch?v=mk6vAyIZZ0A&amp;list=PLc2UaWzFQrPN7XNq2mAkVdsMkRCI0BMML&amp;index=2" rel="nofollow noreferrer">this 8 min tutorial</a>.</p>
  <p>But a few things I can't figure out. Even after adding the Vlc references, and the two Onvif service reference there are a few pieces of the code that wont compile. The tutorial is difficult to follow because he skips major steps. I am trying to identify what <code>Device</code> &amp; <code>Media</code> &amp; <code>EndPointAddress</code> represent in the following code (per his tutorial).</p>
  <pre class="lang-cs prettyprint-override"><code>public partial class MainWindow : Window
  {
     UriBuilder deviceUri;
     Media.Media2Client media;
     Media.MediaProfile[] profiles;
  
     public MainWindow()
     {
        InitializeComponent();
     }
  
  
     private void button1_Click(object sender, EventArgs e)
     {
        //Constructor for the custom Uri requires the onvif service address. 
        deviceUri = new UriBuilder(&quot;http:/onvif/device_service&quot;);
  
        //Sting manipulation: Need to check if our address contains a port. (Input validation)
        string[] addr = Adress.Text.Split(':');
  
        deviceUri.Host = addr[0];
  
        if (addr.Length == 2)
           deviceUri.Port = Convert.ToInt16(addr[1]);
  
        System.ServiceModel.Channels.Binding binding;
        HttpTransportBindingElement httpTransport = new HttpTransportBindingElement();
        httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Digest;
        binding = new CustomBinding(new TextMessageEncodingBindingElement(MessageVersion.Soap12WSAddressing10, Encoding.UTF8), httpTransport);
  
        Device.DeviceClient device = new Device.DeviceClient(binding, new EndpointAddress(deviceUri.ToString()));
        Device.Service[] services = device.GetServices(false);
  
        Device.Service xmedia = services.FirstOrDefault(s =&gt; s.Namespace == &quot;http://www.onvif.org/ver20.media/wsdl&quot;);
  
        if (xmedia != null)
        {
           media = new Media.Media2Client(binding, new EndPointAddress(deviceUri.ToString()));
           media.ClientCredentials.HttpDigest.ToString.ClientCredential.UserName = Login.Text;
           media.ClientCredentials.HttpDigest.ToString.ClientCredential.UserName = Login.Text;
           media.ClientCredentials.HttpDigest.AllowedImpresonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
  
           profiles = media.GetProfiles(null, null);
           if (profiles != null)
              foreach (var p in profiles)
                 listBox1.Items.Add(p.Name);
  
        }
  
        listBox1.SelectionChanged += OnSelectionChanged;
        video.MediaPlayer.VlcLibDirectoryneeded += MediaPlayer_VlcLibDirectoryNeeded;
        video.MediaPlayer.EndInit();
  
  
     }
  
     private void MediaPlayer_VlcLibDirectoryNeeded(object sender, Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs e)
     {
        if (IntPtr.Size == 4)
        {
           e.VlcLibDirectory = new System.IO.DirectoryInfo(@&quot;C:\Program Files\VideoLAN\VLC&quot;);
        }
     }
  
     private void OnSelectionChanged(object sender, RoutedEventArgs e)
     {
        if (profiles != null &amp;&amp; listBox1.SelectedIndex &gt;=)
        {
           UriBuilder uri = new UriBuilder(media.GetStreamUri(&quot;RtspOverHttp&quot;, profiles[listBox1.SelectedIndex].token));
           uri.Host = deviceUri.Host;
           uri.Port = deviceUri.Port;
           uri.Scheme = &quot;rtsp&quot;;
           information.Text = uri.Path; ;
           string[] options = { &quot;:rtsp-http&quot;, &quot;:rtps-http-port=&quot; + uri.Port, &quot;:rtsp-user=&quot; + Login.Text, &quot;:rtsp-pwd=&quot; + passwordBox.Password };
  
           video.MediaPlayer.Play(uri.Uri, options);
  
        }
     }
  }
  </code></pre>