Пример #1
0
        public object Get(GetDynamicHlsVideoSegment request)
        {
            if (string.Equals("baseline", request.PlaylistId, StringComparison.OrdinalIgnoreCase))
            {
                return GetDynamicSegment(request, false).Result;
            }

            return GetDynamicSegment(request, true).Result;
        }
Пример #2
0
        public object Get(GetDynamicHlsVideoSegment request)
        {
            if (string.Equals("baseline", request.PlaylistId, StringComparison.OrdinalIgnoreCase))
            {
                return(GetDynamicSegment(request, false).Result);
            }

            return(GetDynamicSegment(request, true).Result);
        }
Пример #3
0
        private async Task <object> GetDynamicSegment(GetDynamicHlsVideoSegment request, bool isMain)
        {
            var index = int.Parse(request.SegmentId, NumberStyles.Integer, UsCulture);

            var state = await GetState(request, CancellationToken.None).ConfigureAwait(false);

            var playlistPath = Path.ChangeExtension(state.OutputFilePath, ".m3u8");

            var path = GetSegmentPath(playlistPath, index);

            if (File.Exists(path))
            {
                return(GetSegementResult(path));
            }

            if (!File.Exists(playlistPath))
            {
                await StartFfMpeg(state, playlistPath, new CancellationTokenSource()).ConfigureAwait(false);

                await WaitForMinimumSegmentCount(playlistPath, GetSegmentWait(), CancellationToken.None).ConfigureAwait(false);
            }

            return(GetSegementResult(path));
        }
Пример #4
0
 public object Get(GetDynamicHlsVideoSegment request)
 {
     return GetDynamicSegment(request, request.SegmentId).Result;
 }
Пример #5
0
 public Task <object> Get(GetDynamicHlsVideoSegment request)
 {
     return(GetDynamicSegment(request, request.SegmentId));
 }
Пример #6
0
        private async Task<object> GetDynamicSegment(GetDynamicHlsVideoSegment request, bool isMain)
        {
            var index = int.Parse(request.SegmentId, NumberStyles.Integer, UsCulture);

            var state = await GetState(request, CancellationToken.None).ConfigureAwait(false);

            var playlistPath = Path.ChangeExtension(GetOutputFilePath(state), ".m3u8");

            var path = GetSegmentPath(playlistPath, index);

            if (File.Exists(path))
            {
                return GetSegementResult(path);
            }

            if (!File.Exists(playlistPath))
            {
                await StartFfMpeg(state, playlistPath).ConfigureAwait(false);

                await WaitForMinimumSegmentCount(playlistPath, GetSegmentWait()).ConfigureAwait(false);
            }

            return GetSegementResult(path);
        }
Пример #7
0
 public object Get(GetDynamicHlsVideoSegment request)
 {
     return(GetDynamicSegment(request, request.SegmentId).Result);
 }