Exemplo n.º 1
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetHlsVideoSegment request)
        {
            var file = request.SegmentId + Path.GetExtension(Request.PathInfo);

            file = Path.Combine(ServerConfigurationManager.ApplicationPaths.TranscodingTempPath, file);

            return(ResultFactory.GetStaticFileResult(Request, file));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetHlsVideoSegment request)
        {
            var file = request.SegmentId + Path.GetExtension(Request.PathInfo);

            file = Path.Combine(ServerConfigurationManager.ApplicationPaths.TranscodingTempPath, file);

            return ResultFactory.GetStaticFileResult(Request, file);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetHlsVideoSegment request)
        {
            var file = SegmentFilePrefix + request.SegmentId + Path.GetExtension(RequestContext.PathInfo);

            file = Path.Combine(ApplicationPaths.EncodedMediaCachePath, file);

            return ResultFactory.GetStaticFileResult(RequestContext, file);
        }
Exemplo n.º 4
0
        public object Get(GetHlsVideoSegment request)
        {
            var file = SegmentFilePrefix + request.SegmentId + Path.GetExtension(RequestContext.PathInfo);

            file = Path.Combine(ApplicationPaths.EncodedMediaCachePath, file);

            return(ResultFactory.GetStaticFileResult(RequestContext, file));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetHlsVideoSegment request)
        {
            var file = request.SegmentId + Path.GetExtension(RequestContext.PathInfo);

            file = Path.Combine(_appPaths.EncodedMediaCachePath, file);

            OnBeginRequest(request.PlaylistId);

            return(ResultFactory.GetStaticFileResult(RequestContext, file));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetHlsVideoSegment request)
        {
            ExtendHlsTimer(request.Id, request.PlaylistId);

            var file = request.SegmentId + Path.GetExtension(RequestContext.PathInfo);

            file = Path.Combine(ApplicationPaths.EncodedMediaCachePath, file);

            return(ResultFactory.GetStaticFileResult(RequestContext, file));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetHlsVideoSegment request)
        {
            ExtendHlsTimer(request.Id, request.PlaylistId);
            
            var file = request.SegmentId + Path.GetExtension(RequestContext.PathInfo);

            file = Path.Combine(ApplicationPaths.EncodedMediaCachePath, file);

            return ResultFactory.GetStaticFileResult(RequestContext, file);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetHlsVideoSegment request)
        {
            var file = request.SegmentId + Path.GetExtension(Request.PathInfo);

            file = Path.Combine(_config.ApplicationPaths.TranscodingTempPath, file);

            var normalizedPlaylistId = request.PlaylistId.Replace("-low", string.Empty);

            var playlistPath = Directory.EnumerateFiles(_config.ApplicationPaths.TranscodingTempPath, "*")
                               .FirstOrDefault(i => string.Equals(Path.GetExtension(i), ".m3u8", StringComparison.OrdinalIgnoreCase) && i.IndexOf(normalizedPlaylistId, StringComparison.OrdinalIgnoreCase) != -1);

            return(GetFileResult(file, playlistPath));
        }
Exemplo n.º 9
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetHlsVideoSegment request)
        {
            var file = request.SegmentId + Path.GetExtension(Request.PathInfo);

            file = Path.Combine(ServerConfigurationManager.ApplicationPaths.TranscodingTempPath, file);

            var normalizedPlaylistId = request.PlaylistId.Replace("-low", string.Empty);

            foreach (var playlist in Directory.EnumerateFiles(ServerConfigurationManager.ApplicationPaths.TranscodingTempPath, "*.m3u8")
                .Where(i => i.IndexOf(normalizedPlaylistId, StringComparison.OrdinalIgnoreCase) != -1)
                .ToList())
            {
                ExtendPlaylistTimer(playlist);
            }

            return ResultFactory.GetStaticFileResult(Request, file);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetHlsVideoSegment request)
        {
            var file = request.SegmentId + Path.GetExtension(Request.PathInfo);

            file = Path.Combine(ServerConfigurationManager.ApplicationPaths.TranscodingTempPath, file);

            var normalizedPlaylistId = request.PlaylistId.Replace("-low", string.Empty);

            foreach (var playlist in Directory.EnumerateFiles(ServerConfigurationManager.ApplicationPaths.TranscodingTempPath, "*.m3u8")
                     .Where(i => i.IndexOf(normalizedPlaylistId, StringComparison.OrdinalIgnoreCase) != -1)
                     .ToList())
            {
                ExtendPlaylistTimer(playlist);
            }

            return(ResultFactory.GetStaticFileResult(Request, file));
        }
Exemplo n.º 11
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetHlsVideoSegment request)
        {
            foreach (var playlist in Directory.EnumerateFiles(ApplicationPaths.EncodedMediaCachePath, "*.m3u8").ToList())
            {
                ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlist, TranscodingJobType.Hls);

                // Avoid implicitly captured closure
                var playlist1 = playlist;

                Task.Run(async () =>
                {
                    await Task.Delay(2000).ConfigureAwait(false);
                    ApiEntryPoint.Instance.OnTranscodeEndRequest(playlist1, TranscodingJobType.Hls);
                });
            }
            
            var file = SegmentFilePrefix + request.SegmentId + Path.GetExtension(RequestContext.PathInfo);

            file = Path.Combine(ApplicationPaths.EncodedMediaCachePath, file);

            return ResultFactory.GetStaticFileResult(RequestContext, file);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetHlsVideoSegment request)
        {
            foreach (var playlist in Directory.EnumerateFiles(ApplicationPaths.EncodedMediaCachePath, "*.m3u8").ToList())
            {
                ApiEntryPoint.Instance.OnTranscodeBeginRequest(playlist, TranscodingJobType.Hls);

                // Avoid implicitly captured closure
                var playlist1 = playlist;

                Task.Run(async() =>
                {
                    // This is an arbitrary time period corresponding to when the request completes.
                    await Task.Delay(30000).ConfigureAwait(false);

                    ApiEntryPoint.Instance.OnTranscodeEndRequest(playlist1, TranscodingJobType.Hls);
                });
            }

            var file = SegmentFilePrefix + request.SegmentId + Path.GetExtension(RequestContext.PathInfo);

            file = Path.Combine(ApplicationPaths.EncodedMediaCachePath, file);

            return(ResultFactory.GetStaticFileResult(RequestContext, file));
        }
Exemplo n.º 13
0
 public Task<object> Get(GetHlsVideoSegment request)
 {
     return GetDynamicSegment(request, request.SegmentId);
 }
Exemplo n.º 14
0
 public Task <object> Get(GetHlsVideoSegment request)
 {
     return(GetDynamicSegment(request, request.SegmentId));
 }
Exemplo n.º 15
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public object Get(GetHlsVideoSegment request)
        {
            var file = request.SegmentId + Path.GetExtension(Request.PathInfo);

            file = Path.Combine(_appPaths.EncodedMediaCachePath, file);

            OnBeginRequest(request.PlaylistId);

            return ResultFactory.GetStaticFileResult(Request, file);
        }