Add og:video tags
authorChocobozzz <florian.bigard@gmail.com>
Thu, 26 Oct 2017 13:16:05 +0000 (15:16 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Thu, 26 Oct 2017 13:16:05 +0000 (15:16 +0200)
server/controllers/client.ts
server/lib/jobs/handlers/video-file-transcoder.ts

index 1391993a7a1c4c39130efe8efaa185a717948b62..2071b5f0194dd9e613190a1de72953f50bb09e06 100644 (file)
@@ -8,7 +8,8 @@ import {
   CONFIG,
   STATIC_PATHS,
   STATIC_MAX_AGE,
-  OPENGRAPH_AND_OEMBED_COMMENT
+  OPENGRAPH_AND_OEMBED_COMMENT,
+  EMBED_SIZE
 } from '../initializers'
 import { root, readFileBufferPromise, escapeHTML } from '../helpers'
 import { asyncMiddleware } from '../middlewares'
@@ -52,6 +53,7 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
 
   const videoName = escapeHTML(video.name)
   const videoDescription = escapeHTML(video.description)
+  const embedUrl = CONFIG.WEBSERVER.URL + video.getEmbedPath()
 
   const openGraphMetaTags = {
     'og:type': 'video',
@@ -60,6 +62,12 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
     'og:url': videoUrl,
     'og:description': videoDescription,
 
+    'og:video:url': embedUrl,
+    'og:video:secure_url': embedUrl,
+    'og:video:type': 'text/html',
+    'og:video:width': EMBED_SIZE.width,
+    'og:video:height': EMBED_SIZE.height,
+
     'name': videoName,
     'description': videoDescription,
     'image': previewUrl,
@@ -68,7 +76,10 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
     'twitter:site': '@Chocobozzz',
     'twitter:title': videoName,
     'twitter:description': videoDescription,
-    'twitter:image': previewUrl
+    'twitter:image': previewUrl,
+    'twitter:player': embedUrl,
+    'twitter:player:width': EMBED_SIZE.width,
+    'twitter:player:height': EMBED_SIZE.height
   }
 
   const oembedLinkTags = [
index a8d80ed4570411badc5ef02e5d4bd8a10a5cdeba..8536455109aa6a91ac27a85ea4b0435556bf2674 100644 (file)
@@ -37,7 +37,7 @@ async function onSuccess (jobId: number, video: VideoInstance) {
   // Now we'll add the video's meta data to our friends
   await updateVideoToFriends(remoteVideo, null)
 
-  return
+  return undefined
 }
 
 // ---------------------------------------------------------------------------