首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Expression Encoder 4 SDK在直播时抛出DCOM错误

Expression Encoder 4 SDK在直播时抛出DCOM错误
EN

Stack Overflow用户
提问于 2011-11-07 02:37:26
回答 1查看 952关注 0票数 8

我正在尝试将音频和视频从我的PC实时传输到托管服务上的发布点。我已经编写了我认为它应该有的所有代码(目前它只是一个小的控制台应用程序中的测试代码)。代码本身没有抛出错误,它运行得很好,视频是从我的网络摄像头中拉出来的,但是当我试图将流发送到发布点时,我在系统事件日志中得到了一个DCOM错误:"DCOM was unable to communicate with the computer streamwebtown.com using the computer streamwebtown.com using the computer Protocol.“我尝试使用SDK附带的实际Expression Encoder 4客户端应用程序做同样的事情,并且视频/音频提要在相同的发布点上工作得很好。我在互联网上到处寻找,看看是否有人遇到了这个问题,但一无所获。问社区有没有什么想法?

来自应用程序的代码:

代码语言:javascript
复制
static void Main(string[] args)
{
    EncoderDevice video = EncoderDevices.FindDevices(EncoderDeviceType.Video).Count > 0 ? EncoderDevices.FindDevices(EncoderDeviceType.Video)[0] : null;
    EncoderDevice audio = EncoderDevices.FindDevices(EncoderDeviceType.Audio).Count > 0 ? EncoderDevices.FindDevices(EncoderDeviceType.Audio)[0] : null;
    LiveJob job = new LiveJob();
    if (video != null && audio != null)
    {
        LiveDeviceSource source = job.AddDeviceSource(video, audio);
        job.ActivateSource(source);
        PushBroadcastPublishFormat publishingPoint = new PushBroadcastPublishFormat();
        publishingPoint.PublishingPoint = new Uri("http://streamwebtown.com/abc");
        publishingPoint.UserName = "user";
        publishingPoint.Password = PullPW("Stream");
        job.ApplyPreset(LivePresets.VC1Broadband16x9);
        job.PublishFormats.Add(publishingPoint);
        job.StartEncoding();

        Console.ReadKey();
        job.StopEncoding();
    }
}

private static SecureString PullPW(string pw)
{
    SecureString s = new SecureString();
    foreach (char c in pw) s.AppendChar(c);
    return s;
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-11-10 01:25:43

我已经找到了答案,它根本没有向服务器进行身份验证。因此,将我的代码更改为以下代码,它突然就可以正常工作了。

代码语言:javascript
复制
 static void Main(string[] args)
        {

            EncoderDevice video = EncoderDevices.FindDevices(EncoderDeviceType.Video).Count > 0 ? EncoderDevices.FindDevices(EncoderDeviceType.Video)[0] : null;
            EncoderDevice audio = EncoderDevices.FindDevices(EncoderDeviceType.Audio).Count > 0 ? EncoderDevices.FindDevices(EncoderDeviceType.Audio)[0] : null;
            LiveJob job = new LiveJob();
            job.AcquireCredentials += new EventHandler(job_AcquireCredentials);
            if (video != null && audio != null)
            {
                LiveDeviceSource source = job.AddDeviceSource(video, audio);
                job.ActivateSource(source);
                PushBroadcastPublishFormat publishingPoint = new PushBroadcastPublishFormat();
                publishingPoint.PublishingPoint = new Uri("http://streamwebtown.com/abc");

            WindowsMediaOutputFormat wmof = new WindowsMediaOutputFormat();
            VideoProfile vProfile = new AdvancedVC1VideoProfile();
            AudioProfile aProfile = new WmaAudioProfile();
            wmof.VideoProfile = vProfile;
            wmof.AudioProfile = aProfile;

            job.ApplyPreset(LivePresets.VC1Broadband16x9);
            job.PublishFormats.Add(publishingPoint);
            job.OutputFormat = wmof;
            job.PreConnectPublishingPoint();
            job.StartEncoding();
            //After finished encoding dispose of all objects.
            Console.ReadKey();
            job.StopEncoding();
            job.Dispose();
            video.Dispose();
            audio.Dispose();
            source.Dispose();
        }
    }

    static void job_AcquireCredentials(object sender, AcquireCredentialsEventArgs e)
    {
        e.UserName = "user";
        e.Password = PullPW("Stream");
        e.Modes = AcquireCredentialModes.None;
    }

    private static SecureString PullPW(string pw)
    {
        SecureString s = new SecureString();
        foreach (char c in pw) s.AppendChar(c);
        return s;
    }
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8029382

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档