Comments (9)
there's been a few more issues/PRs about this:
- #29 and #38 wanting start time (cc @JuanitoFatas @pavelloz)
- #33 for general extra settings (cc @mkjeldsen)
I think @smartcorestudio's proposed solution is both flexible and means lite-youtube-embed
doesn't have to get bloated to support each feature that the iframe does.
So the idea is make use of a single attribute on our element. Its value will be added into the YT iframe src
's query params.
<lite-youtube videoid="..." params="start=10&end=30"></lite-youtube>
or to use a LOT of them
<lite-youtube videoid="..." params="start=10&end=30&modestbranding=2&rel=0&enablejsapi=1&origin=http://lol.com"></lite-youtube>
I like using an attribute called params
. I can think of a few alternatives, but I like this the best.
Thoughts?
from lite-youtube-embed.
update: [email protected]
published
from lite-youtube-embed.
Seems like a good solution to all current and possible future param-related feature requests anyone might have :)
PS. Sorry for duplicated issue
from lite-youtube-embed.
I'll make sure we get this params
attribute in nice and tidy with PR #28 when I clean it up this weekend (or tomorrow morning possibly. Tight on time tonight.) It's a super good way to give "full" support without building out attributes for every parameter.
from lite-youtube-embed.
@paulirish, don't you think it would make more sense to simplify it with url
param containing whatever (embed or not) YouTube link with or without extra params, like:
id=ogfYd705cRs
(old format)url="https://www.youtube.com/watch?v=ogfYd705cRs"
(new format)url="https://www.youtube.com/watch?time_continue=10&v=ogfYd705cRs&feature=emb_logo"
(with params)url="https://www.youtube.com/embed/ogfYd705cRs?autoplay=1&start=10&end=30&modestbranding=2&rel=0&enablejsapi=1&origin=https://github.com"
(pasted from embedded iframe, plus extra params)
<lite-youtube>
could analyze url
and parse it however decided.
I would even propose to change lite-youtube
to something like video-embed
allowing to handle videos from multiple video hosts, YouTube, Vimeo, etc. Here what I mean (maybe can handle without closing tag or like <lite-video url=""/>
) :
<video-embed url="https://www.youtube.com/watch?v=ogfYd705cRs">
<video-embed url="https://vimeo.com/270506902">
<video-embed url="https://www.dailymotion.com/video/x209qoh">
from lite-youtube-embed.
^ This seems like a much bigger task (including renaming and changing purpose of the whole project) than forwarding params
to the url ;-)
PS. lite-vimeo-embed: https://github.com/luwes/lite-vimeo-embed
from lite-youtube-embed.
Is there any problem with just adding "params=..." now for the element? What could go wrong?
from lite-youtube-embed.
Cheers @paulirish for the note on that PR. That unified params
approach works pretty well in practice for a case like this (at least in my experience building other not-so-public web components for corps). Maximum flexibility with least amount of element API churn.
from lite-youtube-embed.
fixed by #51 (which just landed. shipping in 0.1.0)
from lite-youtube-embed.
Related Issues (20)
- Types: Property 'ready' does not exist on type 'typeof YT'. HOT 1
- Failed to execute 'postMessage' HOT 2
- Type declarations
- On mobile, double click is neccesary HOT 8
- Display a title on the video thumbnail HOT 2
- Graceful degradation if YT API breaks
- NPM version is outdated HOT 1
- Custom Width and Height for Youtube shorts HOT 6
- Will it be counted as views on YouTube? HOT 2
- sometime no image loaded HOT 1
- does not work on mobile HOT 2
- Early click on Progressively Enhanced version directs user to youtube.com HOT 1
- A11Y: Why `a.lty-playbtn` instead of `button`? HOT 2
- Start and end params not working when using js-api
- I am using lite youtube embed and I want to get onStateChange player.getPlayerState():
- How can we keep the lower quality preview?
- Could we get a more noob friendly guide for Pro-usage? 😇
- Deprecated navigator.vendor HOT 1
- v0.3.2 Release HOT 1
- Yield on LiteYTEmbed click listener to reduce INP impact HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lite-youtube-embed.