public IActionResult Get(string recordedDate, string mp4Filename) { string vttContent; try { Storage storage = new Storage(); SkiVideoEntity entity = storage.GetSkiVideoEntity(recordedDate, mp4Filename); if (entity == null) { throw new ApplicationException($"Unable to load SkiVideo {recordedDate}, {mp4Filename}"); } WebVtt vtt = new WebVtt(entity); vttContent = vtt.Create(); _logger.LogInformation($"Created WebVtt for {recordedDate}, {mp4Filename}"); return(Content(vttContent, new Microsoft.Net.Http.Headers.MediaTypeHeaderValue("text/vtt"))); } catch (Exception e) { _logger.LogError("Unable to create WebVtt: " + e.Message); return(StatusCode(500)); } }
public void TestCreateVtt() { Storage storage = new Storage(); SkiVideoEntity entity = storage.GetSkiVideoEntity(RECORDED_DATE, VIDEO_FILE); WebVtt vtt = new WebVtt(entity); string vttContent = vtt.Create(); if (vttContent == null) { System.Console.WriteLine("Nothing.."); } else { System.Console.WriteLine("Content: " + vttContent); } }