Exemple #1
0
        public Task <object> Get(GetHlsPlaylistLegacy request)
        {
            var file = request.PlaylistId + Path.GetExtension(Request.PathInfo);

            file = Path.Combine(ServerConfigurationManager.GetTranscodePath(), file);

            return(GetFileResult(file, file));
        }
Exemple #2
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public Task <object> Get(GetHlsAudioSegmentLegacy request)
        {
            // TODO: Deprecate with new iOS app
            var file = request.SegmentId + Path.GetExtension(Request.PathInfo);

            file = Path.Combine(ServerConfigurationManager.GetTranscodePath(), file);

            return(ResultFactory.GetStaticFileResult(Request, file, FileShareMode.ReadWrite));
        }
        /// <summary>
        /// Gets the output file path.
        /// </summary>
        private string GetOutputFilePath(StreamState state, EncodingOptions encodingOptions, string outputFileExtension)
        {
            var data = $"{state.MediaPath}-{state.UserAgent}-{state.Request.DeviceId}-{state.Request.PlaySessionId}";

            var filename = data.GetMD5().ToString("N", CultureInfo.InvariantCulture);
            var ext      = outputFileExtension?.ToLowerInvariant();
            var folder   = ServerConfigurationManager.GetTranscodePath();

            return(EnableOutputInSubFolder
                ? Path.Combine(folder, filename, filename + ext)
                : Path.Combine(folder, filename + ext));
        }
Exemple #4
0
        /// <summary>
        /// Gets the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        public Task <object> Get(GetHlsVideoSegmentLegacy request)
        {
            var file = request.SegmentId + Path.GetExtension(Request.PathInfo);
            var transcodeFolderPath = ServerConfigurationManager.GetTranscodePath();

            file = Path.Combine(transcodeFolderPath, file);

            var normalizedPlaylistId = request.PlaylistId;

            var playlistPath = _fileSystem.GetFilePaths(transcodeFolderPath)
                               .FirstOrDefault(i => string.Equals(Path.GetExtension(i), ".m3u8", StringComparison.OrdinalIgnoreCase) && i.IndexOf(normalizedPlaylistId, StringComparison.OrdinalIgnoreCase) != -1);

            return(GetFileResult(file, playlistPath));
        }