We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
  • Pages:
  • 1
  • 9
Embed Videos Without BBCode
Topic Started: Jul 24 2012, 06:06 PM (16,618 Views)
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Code name: Embed Videos Without BBCode

Date created: Jul 24 2012

Author(s): Cory

Description: This code will allow you to link to a video from a specified site in a post and it will automatically be embedded.

Preview: Preview #1 - Preview #2

Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board

YouTube:
Code:
 
<script type="text/javascript">
//<![CDATA[
$('a[rel]:contains(youtube.com)').each(function () {
var href = this.href = this.href.replace('watch?', '').replace('=', '/');
$(this).replaceWith('<object width="250" height="250" data="' + href + '" type="application/x-shockwave-flash"><param value="never" name="AllowScriptAccess"><param value="transparent" name="wmode"><param value="' + href + '" name="movie"><param value="true" name="play"><param value="true" name="loop"><param value="high" name="quality"></object>');
});
//]]>
</script>
youtu.be:
Code:
 
<script type="text/javascript">
//<![CDATA[
$('a[rel]:contains(youtu.be)').each(function () {
var href = this.href = this.href.replace('.be/', 'be.com/v/');
$(this).replaceWith('<object width="250" height="250" data="' + href + '" type="application/x-shockwave-flash"><param value="never" name="AllowScriptAccess"><param value="transparent" name="wmode"><param value="' + href + '" name="movie"><param value="true" name="play"><param value="true" name="loop"><param value="high" name="quality"></object>');
});
//]]>
</script>
Vimeo:
Code:
 
<script type="text/javascript">
//<![CDATA[
$('a[rel]:contains(vimeo.com)').each(function () {
var id = this.href.split('/')[3];
$(this).replaceWith('<iframe src="http://player.vimeo.com/video/' + id + '" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>');
});
//]]>
</script>
Dailymotion:
Code:
 
<script type="text/javascript">
//<![CDATA[
$('a[rel]:contains(dailymotion.com)').each(function () {
var href = this.href = this.href.split('_')[0].replace('/video/', '/embed/video/');
$(this).replaceWith('<iframe frameborder="0" width="480" height="270" src="' + href + '"></iframe>');
});
//]]>
</script>
Meta Cafe:
Code:
 
<script type="text/javascript">
//<![CDATA[
$('a[rel]:contains(metacafe.com)').each(function () {
var id = this.href.split('/watch/')[1].split('/')[0];
$(this).replaceWith('<iframe src="http://www.metacafe.com/embed/' + id + '/" width="440" height="248" allowFullScreen frameborder="0"></iframe>');
});
//]]>
</script>
Edited by Cory, Jul 9 2013, 05:51 AM.
Offline Profile Quote Post Goto Top
 
Replies:
extraordinary
Member
[ *  * ]
Cory
Oct 30 2017, 11:06 AM
Remove &autoplay=0 from the URL.

What viewing options are you referring to?
Removing &autoplay=0 broke the video, unfortunately.

And the viewing options I meant were the full screen, play buttons, etc.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Did the video actually play for you with that in the code? With or without it, the video just constantly buffers and never loads for me in Google Chrome.
Offline Profile Quote Post Goto Top
 
extraordinary
Member
[ *  * ]
Cory
Oct 30 2017, 01:52 PM
Did the video actually play for you with that in the code? With or without it, the video just constantly buffers and never loads for me in Google Chrome.
With the autoplay in, it worked in Chrome, but without it, it doesn't pop anything up but a black screen, unfortunately.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
What happens when you change &autoplay=0 to &autoplay=false in the code?
Offline Profile Quote Post Goto Top
 
extraordinary
Member
[ *  * ]
Cory
Oct 30 2017, 06:06 PM
What happens when you change &autoplay=0 to &autoplay=false in the code?
Does the same as if "0" were used.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Try this instead:
Code:
 
<script type="text/javascript">
//<![CDATA[
$('a[rel]:contains(vevo.com)').each(function() {
var id = this.href.split('/')[6];
$(this).replaceWith('<iframe width="640" height="360" src="https://embed.vevo.com?isrc=' + id + '" allowfullscreen=""></iframe>');
});
//]]>
</script>
Offline Profile Quote Post Goto Top
 
extraordinary
Member
[ *  * ]
Cory
Oct 30 2017, 11:50 PM
Try this instead:
Code:
 
<script type="text/javascript">
//<![CDATA[
$('a[rel]:contains(vevo.com)').each(function() {
var id = this.href.split('/')[6];
$(this).replaceWith('<iframe width="640" height="360" src="https://embed.vevo.com?isrc=' + id + '" allowfullscreen=""></iframe>');
});
//]]>
</script>
PERFECT! Thank you so much! That worked!
Offline Profile Quote Post Goto Top
 
alan131210
Member
[ *  * ]
Hi Cory can you pls make a code for this URL for eg?

https://www.facebook.com/FoxNews/videos/10156377529541336/
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Try this:
Code:
 
<script type="text/javascript">
//<![CDATA[
$('a[rel]:contains(facebook.com):contains(/videos/)').each(function() {
var id = this.href.split('/videos/')[1].split('/');
$(this).replaceWith('<iframe type="text/html" width="250" height="250" src="https://www.facebook.com/video/embed?video_id=' + id + '" frameborder="0" allowfullscreen=""></iframe>');
});
//]]>
</script>
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
These codes have been converted to Jcink.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply
  • Pages:
  • 1
  • 9