React-player: Does it support playing local videos?

Created on 27 Oct 2016  路  3Comments  路  Source: cookpete/react-player

When I try to use an input[type=file] to select the video source, I get an net::ERR_UNKNOWN_URL_SCHEME (c:\fakepath\test.mp4) error. I would likely work on support for this if it's not available, but I want to make sure I am not doing something silly.

Most helpful comment

I've had some success with URL.createObjectURL, which generates a blob string you can use as the url:

const input = document.querySelector('[type=file]')
const url = URL.createObjectURL(input.files[0])
return <ReactPlayer playing url={url} />

All 3 comments

I've had some success with URL.createObjectURL, which generates a blob string you can use as the url:

const input = document.querySelector('[type=file]')
const url = URL.createObjectURL(input.files[0])
return <ReactPlayer playing url={url} />

Thank you. That worked perfectly.

I'm trying to do the same but I keep getting a can't read null files error, any suggestions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcuscaum picture marcuscaum  路  3Comments

mrcoles picture mrcoles  路  5Comments

zverbatim picture zverbatim  路  8Comments

AceBunny picture AceBunny  路  4Comments

denishrana09 picture denishrana09  路  3Comments