コード例 #1
0
        /// <summary>
        /// Creates an IngestInputStream and adds it to an encoding<para />
        ///
        /// The IngestInputStream is used to define where a file to read a stream from is located<para />
        ///
        /// API endpoint:
        /// https://bitmovin.com/docs/encoding/api-reference/sections/encodings#/Encoding/PostEncodingEncodingsInputStreamsIngestByEncodingId
        /// </summary>
        /// <param name="encoding">The encoding to which the stream will be added</param>
        /// <param name="input"> The input resource providing the input file</param>
        /// <param name="inputPath"> The path to the input file</param>
        private Task <IngestInputStream> CreateIngestInputStream(Models.Encoding encoding, Input input, String inputPath)
        {
            var ingestInputStream = new IngestInputStream()
            {
                InputId       = input.Id,
                InputPath     = inputPath,
                SelectionMode = StreamSelectionMode.AUTO
            };

            return(_bitmovinApi.Encoding.Encodings.InputStreams.Ingest.CreateAsync(encoding.Id, ingestInputStream));
        }
        /// <summary>
        /// Creates a TimeBasedTrimmingInputStream and adds it to an encoding.
        /// The TimeBasedTrimmingInputStream is used to define a section of an IngestInputStream using an offset and a duration
        ///        expressed in seconds. <para />
        ///
        /// API endpoint:
        /// https://bitmovin.com/docs/encoding/api-reference/sections/encodings#/Encoding/PostEncodingEncodingsInputStreamsTrimmingTimeBasedByEncodingId
        /// </summary>
        /// <param name="encoding">The encoding to add the stream onto</param>
        /// <param name="ingestInputStream">The IngestInputStream instance created from the input file</param>
        /// <param name="offset">Defines the offset in seconds at which the encoding should start, beginning at 0.</param>
        /// <param name="duration">Defines how many seconds of the input will be encoded.</param>
        private Task <TimeBasedTrimmingInputStream> CreateTimeBasedTrimmingInputStream(Models.Encoding encoding, IngestInputStream ingestInputStream,
                                                                                       double offset, double duration)
        {
            var timeBasedTrimmingInputStream = new TimeBasedTrimmingInputStream()
            {
                InputStreamId = ingestInputStream.Id,
                Offset        = offset,
                Duration      = duration
            };

            return(_bitmovinApi.Encoding.Encodings.InputStreams.Trimming.TimeBased.CreateAsync(encoding.Id, timeBasedTrimmingInputStream));
        }