This commit is contained in:
parent
15b1f5728b
commit
95c03afe28
|
@ -39,8 +39,10 @@ import download from "common/download";
|
|||
import * as src from "common/src";
|
||||
|
||||
export const CodecAvc1 = "avc1";
|
||||
export const CodecHvc1 = "hvc1";
|
||||
export const FormatMp4 = "mp4";
|
||||
export const FormatAvc = "avc";
|
||||
export const FormatHvc = "hvc";
|
||||
export const FormatGif = "gif";
|
||||
export const FormatJpeg = "jpg";
|
||||
export const MediaImage = "image";
|
||||
|
@ -474,6 +476,11 @@ export class Photo extends RestModel {
|
|||
|
||||
videoUrl() {
|
||||
let file = this.videoFile();
|
||||
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
||||
|
||||
if (file && file.Codec === CodecHvc1 && isSafari) {
|
||||
return `${config.apiUri}/videos/${file.Hash}/${config.previewToken()}/${FormatHvc}`;
|
||||
}
|
||||
|
||||
if (file) {
|
||||
return `${config.apiUri}/videos/${file.Hash}/${config.previewToken()}/${FormatAvc}`;
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
|
||||
const (
|
||||
ContentTypeAvc = `video/mp4; codecs="avc1"`
|
||||
ContentTypeHvc = `video/mp4; codecs="hvc1"`
|
||||
)
|
||||
|
||||
// AddCacheHeader adds a cache control header to the response.
|
||||
|
|
|
@ -84,7 +84,11 @@ func GetVideo(router *gin.RouterGroup) {
|
|||
}
|
||||
}
|
||||
|
||||
AddContentTypeHeader(c, ContentTypeAvc)
|
||||
if video.Types[formatName] == video.HEVC {
|
||||
AddContentTypeHeader(c, ContentTypeHvc)
|
||||
} else {
|
||||
AddContentTypeHeader(c, ContentTypeAvc)
|
||||
}
|
||||
|
||||
if c.Query("download") != "" {
|
||||
c.FileAttachment(fileName, f.DownloadName(DownloadName(c), 0))
|
||||
|
|
Loading…
Reference in a new issue