Skip to content
This repository has been archived by the owner on Jul 3, 2021. It is now read-only.

Google Drive video playback #93

Closed
ryanjerskine opened this issue Apr 1, 2019 · 1 comment
Closed

Google Drive video playback #93

ryanjerskine opened this issue Apr 1, 2019 · 1 comment
Labels
question Further information is requested

Comments

@ryanjerskine
Copy link

I am wanting to use this project to 'proxy' video playback to Google Drive. An example of the code I am currently using:

[HttpGet("{id}")]
[Authorize]
public async Task<IActionResult> GetAsync([FromRoute] string id, [FromQuery] int? quality)
{
    HttpResponseMessage result = null;
    using (var httpClient = new HttpClient())
    {
        httpClient.DefaultRequestHeaders.Authorization = await this._TokenManager.GetGoogleDriveAuthHeaderAsync();
        result = await httpClient.GetAsync($"https://drive.google.com/get_video_info?docid={id}");
        var actualResult = await result.Content.ReadAsStringAsync();
        var videoInfo = this._VideoInfoParser.Parse(actualResult);
        var q = videoInfo.maps.Where(m => m.quality == "medium").FirstOrDefault();
        return new FileStreamResult(await httpClient.GetStreamAsync(q.url), "video/mp4");
    }
}

Is there a way to do this with ProxyKit or do I need to look for another solution?

@damianh
Copy link
Collaborator

damianh commented May 21, 2019

Firstly, I think your solution is fine and you don't need to seek another. The only thing I would suggest is that you use HttpClientFactory instead of new-ing up your own instance.

Separately I have been thinking about proxykit supporting paramaterised routes, but that will be a future version. I'm closing this because I honestly think your solution is fine.

@damianh damianh closed this as completed May 21, 2019
@damianh damianh added the question Further information is requested label May 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants