feat: add mkv support
I'm going to clean up the redux side of mediaType eventually, this is hacky for now.
This commit is contained in:
parent
4e55415763
commit
5c02b7360f
3 changed files with 13 additions and 3 deletions
|
@ -104,6 +104,12 @@ class FileRender extends React.PureComponent<Props> {
|
|||
|
||||
// Supported contentTypes
|
||||
const contentTypes = {
|
||||
'application/x-ext-mkv': (
|
||||
<VideoViewer uri={uri} source={source} contentType={contentType} onEndedCB={this.onEndedCb} />
|
||||
),
|
||||
'video/x-matroska': (
|
||||
<VideoViewer uri={uri} source={source} contentType={contentType} onEndedCB={this.onEndedCb} />
|
||||
),
|
||||
'application/pdf': <PdfViewer source={downloadPath || source} />,
|
||||
'text/html': <HtmlViewer source={downloadPath || source} />,
|
||||
'text/htm': <HtmlViewer source={downloadPath || source} />,
|
||||
|
|
|
@ -58,9 +58,12 @@ export default function FileViewer(props: Props) {
|
|||
});
|
||||
|
||||
const inline = pageUri === uri;
|
||||
const forceVideo = ['application/x-ext-mkv', 'video/x-matroska'].includes(contentType);
|
||||
const webStreamOnly = contentType === 'application/pdf' || mediaType === 'text';
|
||||
const isReadyToPlay =
|
||||
(IS_WEB && (isStreamable || webStreamOnly)) || (isStreamable && streamingUrl) || (fileInfo && fileInfo.completed);
|
||||
(IS_WEB && (isStreamable || webStreamOnly || forceVideo)) ||
|
||||
((isStreamable || forceVideo) && streamingUrl) ||
|
||||
(fileInfo && fileInfo.completed);
|
||||
const loadingMessage =
|
||||
!isStreamable && fileInfo && fileInfo.blobs_completed >= 1 && (!fileInfo.download_path || !fileInfo.written_bytes)
|
||||
? __("It looks like you deleted or moved this file. We're rebuilding it now. It will only take a few seconds.")
|
||||
|
|
|
@ -45,10 +45,11 @@ export default function FileViewer(props: Props) {
|
|||
costInfo,
|
||||
} = props;
|
||||
const cost = costInfo && costInfo.cost;
|
||||
const isPlayable = ['audio', 'video'].includes(mediaType);
|
||||
const forceVideo = ['application/x-ext-mkv', 'video/x-matroska'].includes(contentType);
|
||||
const isPlayable = ['audio', 'video'].includes(mediaType) || forceVideo;
|
||||
const fileStatus = fileInfo && fileInfo.status;
|
||||
const webStreamOnly = contentType === 'application/pdf' || mediaType === 'text';
|
||||
const supported = (IS_WEB && (isStreamable || webStreamOnly)) || !IS_WEB;
|
||||
const supported = (IS_WEB && (isStreamable || webStreamOnly || forceVideo)) || !IS_WEB;
|
||||
|
||||
// Wrap this in useCallback because we need to use it to the keyboard effect
|
||||
// If we don't a new instance will be created for every render and react will think the dependencies have changed, which will add/remove the listener for every render
|
||||
|
|
Loading…
Reference in a new issue