本文介绍了Expression Encoder 3 Livejob,是否可以在某个时刻开始流式传输文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以从文件创建一个LiveJob并让它开始在特定点广播,比如文件duraction 3分钟?
Is it possible to create a LiveJob from a file and have it begin broadcasting at a certain point say 3 mintues into the the file duraction?
我粘贴了livejob示例来自编码器sdk。
I pasted the livejob example from the encoder sdk.
例如
LiveFileSource.jumpto(new timespan(0,3,0)); //跳转到源文件三分钟。
LiveFileSource.jumpto(new timespan(0,3,0)); //jumpto three minutes into the source file.
我意识到.jumpto不能以这种方式运行,但是有什么用呢?
I realize the .jumpto does not function in this manner, but is there something that does?
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Expression.Encoder;
using Microsoft.Expression.Encoder.Live;
namespace Live
{
class Program
{
/// <summary>
/// This sample demonstrates boadcasting a simple file continuously looped.
/// </summary>
/// <param name="args">input parameters, the name of the file we are going to broadcast</param>
static void Main(string[] args)
{
// We should have only 1 string in the argument array, and
// it should be the name of the file we are going to encode
if (args.Length != 1)
{
Console.Out.WriteLine("Usage: live <file_name>");
return;
}
string fileToEncode = args[0];
// Create a new LiveJob to begin broadcasting this file. Make sure
// to dispose the LiveJob when you are finished with it.
using (LiveJob job = new LiveJob())
{
// Create a new file source from the file name we were passed in
LiveFileSource fileSource = job.AddFileSource(fileToEncode);
// Set this source to Loop when finished
fileSource.PlaybackMode = FileSourcePlaybackMode.Loop;
// Make this source the active one
job.ActivateSource(fileSource);
// Create a new windows media broadcast output format so we
// can broadcast this encoding on the current machine.
// We are going to use the default audio and video profiles
// that are created on this output format.
WindowsMediaBroadcastOutputFormat outputFormat = new WindowsMediaBroadcastOutputFormat();
// Let's broadcast on the local machine on port 8080
outputFormat.BroadcastPort = 8080;
// Set the output format on the job
job.OutputFormat = outputFormat;
// Start encoding
Console.Out.Write("Press 'x' to stop encoding...");
job.StartEncoding();
// Let's listen for a keypress to know when to stop encoding
while (Console.ReadKey(true).Key != ConsoleKey.X)
{
// We are waiting for the 'x' key
}
// Stop our encoding
Console.Out.WriteLine("Encoding stopped.");
job.StopEncoding();
}
}
}
}
推荐答案
这篇关于Expression Encoder 3 Livejob,是否可以在某个时刻开始流式传输文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!