-
-
Notifications
You must be signed in to change notification settings - Fork 692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[11.0][ADD] website_video_preview #439
Conversation
Is anyone interested in this module? |
website_video_preview/README.rst
Outdated
===================== | ||
|
||
This module initially only shows a preview of videos instead of directly loading the iframe. | ||
The iframe is loaded when the user clicks on the preview image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, improve long and short description as is not really clear what your module adds.
I had to read the code to understand :)
You should also stress a bit the advantages of not loading the IFRAME to the avg user ;)
Basically, answer the obvious question: "why should I use this module?"
var $media = $(res); | ||
|
||
// Add preview | ||
var $play_button = $('<img class="play_button" src="/website_video_preview/static/src/img/yt_button.png"/>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the idea is to support more video provider I'd pave it by splitting this code to convenient functions.
You could have a mapping of providers and a matching regex for urls, something like:
video_providers: {
'youtube': {'regex': $url_regex, 'handler': this.handle_youtube, 'preview_img': '/foo/baz.png'},
'vimeo': {'regex': $url_regex, 'handler': this.handle_vimeo, 'preview_img': '/foo/bar.png'},
[...]
}
what do you think?
@tarteo mind to talk about this in person? :) |
Where are you ;)? |
Hey @simahawk I refactored the code to your suggestion, what do you think? |
#. Go in editing mode on the website | ||
#. Go to the location where you want to insert a video | ||
#. Insert the video | ||
#. Save the page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth to mention how you can extend it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @simahawk I've added this to the JS files including other documentation for the functions. Can you review it? 😄
website_video_preview/static/src/js/website_video_preview.editor.js
Outdated
Show resolved
Hide resolved
@tarteo LG but I've tested it on runbot and I get the preview on video edit but no one when you close the popup nor when you just view the page see it in action: |
@simahawk The issue was that your video is really old, which has no high quality thumbnail. So what I did is replace it with 0.jpg which always works for all videos. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tarteo works now, thanks!
Overall: LG.
Just a tip, but not blocking of course: I'd use fadeIn/Out to switch between image and iframe to make the transition smoother.
@OCA/website-maintainers Can someone also review this? :) |
This PR has the |
This module initially only shows a preview of videos instead of directly loading the iframe.
The iframe is loaded when the user clicks on the preview image.
Currently only YouTube videos are supported.