diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index 71dbed6..338f731 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -1136,6 +1136,16 @@ class Media(models.Model): return False return os.path.exists(self.media_file.path) + @property + def content_type(self): + if not self.downloaded: + return 'video/mp4' + vcodec = self.downloaded_video_codec.lower() + if vcodec == 'vp9': + return 'video/webm' + else: + return 'video/mp4' + @property def nfoxml(self): ''' diff --git a/tubesync/sync/templates/sync/media-item.html b/tubesync/sync/templates/sync/media-item.html index 868b1c1..1ce3a2a 100644 --- a/tubesync/sync/templates/sync/media-item.html +++ b/tubesync/sync/templates/sync/media-item.html @@ -13,7 +13,7 @@ -
+ {% endif %} diff --git a/tubesync/sync/views.py b/tubesync/sync/views.py index b6bf35a..ad6aa8b 100644 --- a/tubesync/sync/views.py +++ b/tubesync/sync/views.py @@ -677,8 +677,8 @@ class MediaContent(DetailView): def dispatch(self, request, *args, **kwargs): self.object = self.get_object() - headers = { + 'Content-Type': self.object.content_type, 'X-Accel-Redirect': self.object.media_file.url, } return HttpResponse(headers=headers)