-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe37bb1
commit 7d2cf05
Showing
1 changed file
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,43 @@ | ||
video-embed [](https://travis-ci.org/jellekralt/video-embed) | ||
=========== | ||
|
||
Generate video embed code for services like YouTube and Vimeo | ||
This module generates video embed code for services like YouTube and Vimeo. | ||
In short, it converts this: | ||
|
||
``` | ||
https://www.youtube.com/watch?v=oHg5SJYRHA0 | ||
``` | ||
|
||
To this: | ||
|
||
```javascript | ||
<iframe src="//www.youtube.com/embed/oHg5SJYRHA0" frameborder="0" allowfullscreen></iframe> | ||
``` | ||
|
||
## Usage | ||
```javascript | ||
var videoEmbed = require('video-embed'); | ||
|
||
var embedHTML = videoEmbed('https://www.youtube.com/watch?v=oHg5SJYRHA0'); | ||
|
||
console.log(embedHTML); | ||
// <iframe src="//www.youtube.com/embed/oHg5SJYRHA0" frameborder="0" allowfullscreen></iframe> | ||
``` | ||
|
||
## Video website support | ||
The module currently supports the following video websites: | ||
|
||
### YouTube | ||
The module supports the following YouTube link formats | ||
* https://www.youtube.com/watch?v=oHg5SJYRHA0 | ||
* http://youtu.be/oHg5SJYRHA0 | ||
|
||
### Vimeo | ||
The module supports the following Vimeo link formats | ||
* http://vimeo.com/2619976 | ||
|
||
### Other websites | ||
If you'd like other video websites to be supported you are more than welcome to submit a pull request or an issue requesting a site :smiley: | ||
|
||
## Licence | ||
MIT: http://jellekralt.mit-license.org/ |