Esempio n. 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;
        }
Esempio n. 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);
        }
Esempio n. 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));
        }
 public object Get(GetDynamicHlsVideoSegment request)
 {
     return GetDynamicSegment(request, request.SegmentId).Result;
 }
Esempio n. 5
0
 public Task <object> Get(GetDynamicHlsVideoSegment request)
 {
     return(GetDynamicSegment(request, request.SegmentId));
 }
Esempio n. 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);
        }
Esempio n. 7
0
 public object Get(GetDynamicHlsVideoSegment request)
 {
     return(GetDynamicSegment(request, request.SegmentId).Result);
 }