소스 검색

fix iframe embed urls

bach 2 년 전
부모
커밋
15c6e2e0d2
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      src/views/Static.vue

+ 5 - 3
src/views/Static.vue

@@ -27,13 +27,15 @@ export default {
       // console.log('videolinks', videolinks);
       for (let link of videolinks){
         console.log('videolink', link);
-        let iframe;
+        let url, iframe;
         switch (link[1]) {
           case 'vimeo.com':
-            iframe = `<iframe src="${link[0]}" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>`
+            url = `https://player.vimeo.com/video/${link[3]}`;
+            iframe = `<iframe src="${url}" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>`
             break;
           case 'www.youtube.com':
-            iframe = `<iframe src="${link[0]}" frameborder="0" allowfullscreen></iframe>`
+            url = `https://www.youtube.com/embed/${link[3]}`;
+            iframe = `<iframe src="${url}" frameborder="0" allowfullscreen></iframe>`
             break;
         }
         console.log('iframe', iframe);