Windows phone 8 WP8媒体元素源

Windows phone 8 WP8媒体元素源,windows-phone-8,mp4,mediaelement,ip-camera,Windows Phone 8,Mp4,Mediaelement,Ip Camera,我试图设置一个媒体元素来播放来自http源的视频。来源是一个ip摄像头,它就是不工作,我不知道为什么 using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Navigation; using Microsoft.Phone.Contro

我试图设置一个媒体元素来播放来自http源的视频。来源是一个ip摄像头,它就是不工作,我不知道为什么

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using FullCam.Resources;

namespace FullCam
{
    public partial class MainPage : PhoneApplicationPage
{

    // Constructor
    public MainPage()
    {
        string sourceURL = "http://xxx.xxx.xxx.xxx/display_pic.cgi?cam=1&id=807933130&res=hi&format=mp4&txmode=binary";
        InitializeComponent();

       // Sample code to localize the ApplicationBar
        BuildLocalizedApplicationBar();
        iniCamBox(camBox_1, sourceURL, "user", "password");
    }

    private void BuildLocalizedApplicationBar()
     {
        // Set the page's ApplicationBar to a new instance of ApplicationBar.
        ApplicationBar = new ApplicationBar();

        // Create a new button and set the text value to the localized string from AppResources.
        ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
        appBarButton.Text = AppResources.AppBarButtonText;
       ApplicationBar.Buttons.Add(appBarButton);

       // Create a new menu item with the localized string from AppResources.
       ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
        ApplicationBar.MenuItems.Add(appBarMenuItem);
    }

    private void iniCamBox(MediaElement box, string source, string user, string pass)
    {
        Uri mainSource = new Uri(source);

        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(mainSource);
        req.Credentials = new NetworkCredential(user, pass);

        box.Source = mainSource;
        box.Play();
    }
}
}

我以前从未这样做过,所以我不确定我是否正确进行了操作。

我的建议是看一下本教程

我看了本教程,但我仍然不明白为什么我上面的内容不起作用?vidBox没有定义/或者至少没有在您显示的代码中定义/我使用可视化编辑器放置了控件。它就在那里,只是好像没有播放源代码的视频?消息来源正在工作。听起来和你的问题很相似。嗨!您是否尝试过与其他玩家一起阅读您的“sourceUrl”?(VLC、Windows Media Player或浏览器)这样就行了??我在chrome web浏览器中使用了sourceurl,它可以作为jpeg和mp4源文件使用。将
box.Play()
放入
\u Media opened