function EmbedTubeVideoT(YTPermalink, width, height, autostart) {
if(YTPermalink == null || YTPermalink == "illegal"){
//Nope, we can't.
document.writeln(" error: illegal use of video tag! ");
}else{
//Add the code to the document.
genCode = YTPermalink.replace(new RegExp(/http\:\/\/www\.youtube\.com\/\?v\=/g), "");
genCode = genCode.replace(new RegExp(/http\:\/\/www\.youtube\.com\/watch\?v\=/g), "");
genCode = genCode.replace(new RegExp(/http\:\/\/www\.youtube\.com\/v\//g), "");
//document.writeln("gencode-"+genCode);
document.writeln('<object width="' + width + '" height="' + height + '"><param name="movie" value="http://www.youtube.com/v/' + genCode + '"><param name="wmode" value="transparent" /></param>');
document.writeln('<embed src="http://www.youtube.com/v/' + genCode + '" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="transparent"></embed></object>');
document.writeln('<br><center>Hosted by <a href ="' + YTPermalink + '" target="_blank">YouTube</a></center>');
}
}Originally posted by Podge
Marcel did a mod for this ages ago.
http://forum.snitz.com/forum/topic.asp?TOPIC_ID=60387
Originally posted by JJenson
That would be great but your text file isn't showing me the whole code?![]()
I wrote this mod for Snitz Forum to use a simple forum code like:
[youtube]gJmX1z1NY2c[/youtube]
to embed a youtube video in the forum.
Modify "inc_func_common.asp" adding the following function at the end of the file, before the <script> section:
____________________________________
<%
Function ReplaceYouTubeTags(fString)
Dim oTag, cTag
Dim roTag1, rcTag1, roTag2, rcTag2
Dim oTagPos, cTagPos
Dim nTagPos
Dim counter1, counter2
Dim strCodeText
Dim Tagcount
Dim strTempString, strResultString
TagCount = 1
Dim CodeTags(1,2,3)
Dim strArray, strArray2
CodeTags(1,1,1) = "[youtube]"
CodeTags(1,2,1) = "[/youtube]"
CodeTags(1,1,2) = "<object width=""425"" height=""353""><param name=""movie"" value=""http://www.youtube.com/v/"
CodeTags(1,2,2) = """></param><param name=""wmode"" value=""transparent""></param>"
CodeTags(1,1,3) = "<embed src=""http://www.youtube.com/v/"
CodeTags(1,2,3) = """ type=""application/x-shockwave-flash"" wmode=""transparent"" width=""425"" height=""353""></embed></object>"
strResultString = ""
strTempString = fString
for counter1 = 1 to TagCount
oTag = CodeTags(counter1,1,1)
roTag1 = CodeTags(counter1,1,2)
roTag2 = CodeTags(counter1,1,3)
cTag = CodeTags(counter1,2,1)
rcTag1 = CodeTags(counter1,2,2)
rcTag2 = CodeTags(counter1,2,3)
oTagPos = InStr(1, strTempString, oTag, 1)
cTagPos = InStr(1, strTempString, cTag, 1)
if (oTagpos > 0) and (cTagPos > 0) then
strArray = Split(strTempString, oTag, -1, 1)
for counter2 = 0 to Ubound(strArray)
if (Instr(1, strArray(counter2), cTag) > 0) then
strArray2 = split(strArray(counter2), cTag, -1, 1)
strCodeText = trim(strArray2(0))
strCodeText = replace(strCodeText, """", " ") ' ## filter out "
'## Added to exclude Javascript and other potentially hazardous characters
strCodeText = replace(strCodeText, "&", " ", 1, -1, 1) ' ## filter out &
strCodeText = replace(strCodeText, "#", " ", 1, -1, 1) ' ## filter out #
strCodeText = replace(strCodeText, ";", " ", 1, -1, 1) ' ## filter out ;
strCodeText = replace(strCodeText, "+", " ", 1, -1, 1) ' ## filter out +
strCodeText = replace(strCodeText, "(", " ", 1, -1, 1) ' ## filter out (
strCodeText = replace(strCodeText, ")", " ", 1, -1, 1) ' ## filter out )
strCodeText = replace(strCodeText, "[", " ", 1, -1, 1) ' ## filter out [
strCodeText = replace(strCodeText, "]", " ", 1, -1, 1) ' ## filter out ]
strCodeText = replace(strCodeText, "=", " ", 1, -1, 1) ' ## filter out =
strCodeText = replace(strCodeText, "*", " ", 1, -1, 1) ' ## filter out *
strCodeText = replace(strCodeText, "'", " ", 1, -1, 1) ' ## filter out '
strCodeText = replace(strCodeText, vbTab, " ", 1, -1, 1) ' ## filter out Tabs
strCodeText = replace(strCodeText, "view-source", " ", 1, -1, 1) ' ## filter out view-source
strCodeText = replace(strCodeText, "javascript", " ", 1, -1, 1) ' ## filter out javascript
strCodeText = replace(strCodeText, "jscript", " ", 1, -1, 1) ' ## filter out jscript
strCodeText = replace(strCodeText, "vbscript", " ", 1, -1, 1) ' ## filter out vbscript
strCodeText = replace(strCodeText, "mailto", " ", 1, -1, 1) ' ## filter out mailto
'## End Added
strCodeText = replace(strCodeText, "<", " ") ' ## filter out <
strCodeText = replace(strCodeText, ">", " ") ' ## filter out >
strCodeText = replace(strCodeText, "<br />", vbNewLine)
strResultString = strResultString & roTag1 & strCodeText & rcTag1 & roTag2 & strCodeText & rcTag2 & strArray2(1)
else
strResultString = strResultString & strArray(counter2)
end if
next
strTempString = strResultString
strResultString = ""
end if
next
ReplaceYouTubeTags = strTempString
end function
%>
____________________________________
At line 239 change:
____________________________________
if strAllowForumCode = "1" then
fString = extratags(fString)
end if
____________________________________
to
____________________________________
if strAllowForumCode = "1" then
fString = extratags(fString)
fString = ReplaceYouTubeTags(fString)
end if
____________________________________
Now you can use the brand new forum code!
If you want, you can modify "pop_forum_code.asp",
adding the following code before if (strIMGInPosts = "1"), at line 158.
____________________________________
Response.Write "<p><b>YouTube:</b> Enclose the video hash code with [youtube] and [/youtube] . <i>Example:</i> Here is a video: <b>[youtube]</b>gJmX1z1NY2c<b>[/youtube]</b></p>" & vbNewLine
____________________________________
Ciao!
Luca Panella
29-Aug-2007
Originally posted by Podge
Its because of the <script> tag.
Originally posted by leatherlips
It would be nice to have a YouTube button to automatically add the YouTube tags...
//YouTube MOD below
function youtube() {
var text = getText();
if (helpstat){
alert("YouTube tag inserts a video hosted by YouTube into the post.\n\nExample: [youtube]gJmX1z1NY2c[/youtube]\n\nDo NOT insert the entire YouTube link. ONLY insert the code in the URL that appears after the equals sign (=).\n\nExample: DO NOT enter http://www.youtube.com/watch?v=aWZ8xlc2-0s. Instead look for what comes after the = sign, which in this case would be aWZ8xlc2-0s.");
} else if (basic) {
AddTxt="[youtube]" + text + "[/youtube]";
AddText(AddTxt);
} else {
if (text) {
txt=prompt("Only insert the section of the URL that appears after the equals sign (=).",text);
} else {
txt=prompt("Enter the YouTube identification code for your video.","Only insert the section of the URL that appears after the equals sign (=).");
}
if(txt!=null) {
AddTxt="[youtube]"+txt+"[/youtube]";
AddText(AddTxt);
}
}
}
//YouTube Mod aboveOriginally posted by AnonJrYep, I'm still working on it. The current *yet unreleased* code allows posting videos by means of the entire YouTube code, YouTube permaurl and DailyMotion code inbetween de [video][/video] brackets.
I know Marcel was working on something like that... I'm not sure if he finished.
Is it possible to allow members to insert the entire YouTube URL?
Originally posted by Webbo
I must agree though if the full URL could be added it would make it a lot more user friendly
Originally posted by lucapan
Done! See the first post (there is only one zip file now).
Bye.
CodeTags(1,1,1) = "[youtube]"
CodeTags(1,2,1) = "[/youtube]"
CodeTags(1,1,2) = "<object width=""490"" height=""300""><param name=""movie"" value=""http://www.youtube.com/v/"
CodeTags(1,2,2) = """></param><param name=""wmode"" value=""transparent""></param><param name=""allowfullscreen"" value=""true""></param>"
CodeTags(1,1,3) = "<embed src=""http://www.youtube.com/v/"
CodeTags(1,2,3) = """ type=""application/x-shockwave-flash"" wmode=""transparent"" width=""490"" height=""300""></embed></object>" CodeTags(1,2,3) = "&showinfo=0&hd=1&border=1&color1=000066&color2=000066&iv_load_policy=3&fs=1"" type=""application/x-shockwave-flash"" .....</embed></object>"
Does it work for you?
Does it work for you?
CodeTags(1,1,1) = "[youtube]"
CodeTags(1,2,1) = "[/youtube]"
CodeTags(1,1,2) = "<object width=""640"" height=""390""><param name=""movie"" value=""http://www.youtube.com/v/"
CodeTags(1,2,2) = "&fs=1""></param><param name=""allowFullScreen"" value=""true""></param><param name=""wmode"" value=""transparent""></param>"
CodeTags(1,1,3) = "<embed src=""http://www.youtube.com/v/"
CodeTags(1,2,3) = "&fs=1"" type=""application/x-shockwave-flash""allowfullscreen=""true"" wmode=""transparent"" width=""640"" height=""390""></embed></object>"
CodeTags(1,1,1) = "[youtube]"
CodeTags(1,2,1) = "[/youtube]"
CodeTags(1,1,2) = "<object width=""640"" height=""390""><param name=""movie"" value=""http://www.youtube.com/v/"
CodeTags(1,2,2) = "&fs=1""></param><param name=""allowFullScreen"" value=""true""></param><param name=""wmode"" value=""transparent""></param>"
CodeTags(1,1,3) = "<embed src=""http://www.youtube.com/v/"
CodeTags(1,2,3) = "&fs=1"" type=""application/x-shockwave-flash""allowfullscreen=""true"" wmode=""transparent"" width=""640"" height=""390""></embed></object>"Originally posted by webewitch
I've changed the code a wee bit to the now standard size of 640x390 and added the fullscreen button:Code:CodeTags(1,1,1) = "[youtube]"
CodeTags(1,2,1) = "[/youtube]"
CodeTags(1,1,2) = "<object width=""640"" height=""390""><param name=""movie"" value=""http://www.youtube.com/v/"
CodeTags(1,2,2) = "&fs=1""></param><param name=""allowFullScreen"" value=""true""></param><param name=""wmode"" value=""transparent""></param>"
CodeTags(1,1,3) = "<embed src=""http://www.youtube.com/v/"
CodeTags(1,2,3) = "&fs=1"" type=""application/x-shockwave-flash""allowfullscreen=""true"" wmode=""transparent"" width=""640"" height=""390""></embed></object>"
One slight problem I have is that while most of the videos work on my iPhone a few don't . e.g. this one;
[youtube]http://www.youtube.com/watch?v=o-WZU1X--IM[/youtube]
Can't figure out what's so different about it. It shows fine on my website
Originally posted by Astralis
Is there an updated code for YouTube's IFRAME option, which is the standard option. It should be a piece of cake to code if no one has tried it yet.
<%
'###############################################################################
'##
'## Snitz Forums 2000 v3.4.07
'##
'###############################################################################
'##
'## Copyright © 2000-14 Michael Anderson, Pierre Gorissen,
'## Huw Reddick and Richard Kinser
'##
'## This program is free. You can redistribute and/or modify it under the
'## terms of the GNU General Public License as published by the Free Software
'## Foundation; either version 2 or (at your option) any later version.
'##
'## All copyright notices regarding Snitz Forums 2000 must remain intact in
'## the scripts and in the HTML output. The "powered by" text/logo with a
'## link back to http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful but
'## WITHOUT ANY WARRANTY; without even an implied warranty of MERCHANTABILITY
'## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
'## for more details.
'##
'## You should have received a copy of the GNU General Public License along
'## with this program; If not, write to:
'##
'## Free Software Foundation, Inc.
'## 59 Temple Place, Suite 330
'## Boston, MA 02111-1307
'##
'## Support can be obtained from our support forums at:
'##
'## http://forum.snitz.com
'##
'## Correspondence and marketing questions can be sent to:
'##
'## manderson@snitz.com
'##
'###############################################################################
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_header.asp"-->
<%
Response.Write " <table border=""0"" width=""100%"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td width=""33%"" align=""left"" nowrap><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" " & getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolderOpenTopic,"","align=""absmiddle""") & " YouTube Frame Player<br /></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" <br />" & vbNewLine
If Request("VideoID")="" Then
Call AnyForm
WriteFooter
Response.End
Else
strVideoID=Request("VideoID")
If left(strVideoID,13)="http://youtu." Then
strVideoID=mid(strVideoID,17)
End If
For i = len(strVideoID) to 1 step -1
If mid(strVideoID,i,5)="watch" Then
strVideoID=mid(strVideoID,i+8,len(strVideoID)-9)
Exit For
End If
Next
For j = 1 to len(strVideoID)
If mid(strVideoID,j,1)="&" Then
strVideoID=left(strVideoID,j-1)
Exit For
End If
Next
%>
<!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
<div id="player"></div>
<%
If Request("submit")="Preview" Then
%>
<script>
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// 3. This function creates an <iframe> (and YouTube player)
// after the API code downloads.
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: '<%=strVideoID%>',
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
event.target.playVideo();
}
// 5. The API calls this function when the player's state changes.
// The function indicates that when playing a video (state=1),
// the player should play for six seconds and then stop.
var done = false;
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.PLAYING && !done) {
setTimeout(stopVideo, 6000);
done = true;
}
}
function stopVideo() {
player.stopVideo();
}
</script>
<%
Else
%>
<script>
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// 3. This function creates an <iframe> (and YouTube player)
// after the API code downloads.
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: '<%=strVideoID%>',
events: {
'onReady': onPlayerReady
}
});
}
// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
event.target.playVideo();
}
</script>
<%
End If
WriteFooter
Response.End
End If
Sub AnyForm
Response.Write "<form action=""tubeframe.asp"" method=""post"">" & vbNewLine & _
" <table align=""center"" width=""75%"" cellpadding=""0"" cellspacing=""0"" style=""border-collapse:collapse;"" border=""0"" bgColor=""transparent"">" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""center"" width=""100%"" bgColor=""" & strTableBorderColor & """>" & vbNewLine & _
" <table align=""center"" width=""100%"" cellpadding=""4"" cellspacing=""1"" style=""border-collapse:collapse;"" border=""1"">" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""center"" width=""100%"" bgColor=""" & strHeadCellColor & """ colspan=""2"">" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHeadFontColor & """><b>YouTube IFrame Player</b>" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""right"" width=""50%"" bgColor=""" & strForumCellColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """><b>YouTube Video ID (or entire URL): </b>" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"" width=""50%"" bgColor=""" & strForumCellColor & """>" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """>" & vbNewLine & _
" <input type=""text"" style=""width:95%; color:maroon; font-strength:bold;"" maxlength=""50"" name=""VideoID"" value=""" & Request("VideoID") & """ />" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""top"">" & vbNewLine & _
" <td colspan=""2"" width=""100%"" align=""center"" bgColor=""transparent"">" & vbNewLine & _
" <button type=""image"" name=""submit"" value=""Watch"" style=""border:none; background:transparent;""><img src=""" & strImageURL & "Watch.png"" alt=""Watch"" height=""35"" width=""70"" /> <button type=""image"" name=""submit"" value=""Preview"" style=""border:none; background:transparent;""><img src=""" & strImageURL & "Preview.png"" alt=""Preview"" height=""35"" width=""70"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form>" & vbNewLine
End Sub
%>
http://youtu.be/MhNDKZmxRLM?t=21s
http://youtu.be/MhNDKZmxRLM
Here's an example of what a member has to place in a post for just a regular YouTube video.
[youtube]XYBehBWgGPY[/youtube]
I wrote this mod for Snitz Forum to use a simple forum code like:
[youtube]http://www.youtube.com/watch?v=gJmX1z1NY2c[/youtube]
to embed a youtube video in the forum.
____________________________________
Modify "inc_func_common.asp" adding the following function at the end of the file, before the <script> section:
<%
Function ReplaceYouTubeTags(fString)
Dim oTag, cTag
Dim roTag1, rcTag1, roTag2, rcTag2
Dim oTagPos, cTagPos
Dim nTagPos
Dim counter1, counter2, counter3
Dim strCodeText
Dim Tagcount
Dim strTempString, strResultString
TagCount = 1
Dim CodeTags(1,2,3)
Dim strArray, strArray2, strArray3, strArray4
CodeTags(1,1,1) = "[youtube]"
CodeTags(1,2,1) = "[/youtube]"
CodeTags(1,1,2) = "<object width=""425"" height=""353""><param name=""movie"" value=""http://www.youtube.com/v/"
CodeTags(1,2,2) = """></param><param name=""wmode"" value=""transparent""></param>"
CodeTags(1,1,3) = "<embed src=""http://www.youtube.com/v/"
CodeTags(1,2,3) = """ type=""application/x-shockwave-flash"" wmode=""transparent"" width=""425"" height=""353""></embed></object>"
strResultString = ""
strTempString = fString
for counter1 = 1 to TagCount
oTag = CodeTags(counter1,1,1)
roTag1 = CodeTags(counter1,1,2)
roTag2 = CodeTags(counter1,1,3)
cTag = CodeTags(counter1,2,1)
rcTag1 = CodeTags(counter1,2,2)
rcTag2 = CodeTags(counter1,2,3)
oTagPos = InStr(1, strTempString, oTag, 1)
cTagPos = InStr(1, strTempString, cTag, 1)
if (oTagpos > 0) and (cTagPos > 0) then
strArray = Split(strTempString, oTag, -1, 1)
for counter2 = 0 to Ubound(strArray)
if (Instr(1, strArray(counter2), cTag) > 0) then
strArray2 = split(strArray(counter2), cTag, -1, 1)
strCodeText = trim(strArray2(0))
if (LCase(Left(strCodeText,2))="<a") then
strArray3 = split(strCodeText, ">", -1, 1)
if (UBound(strArray3)>0) then
strCodeText = Left(strArray3(1), Len(strArray3(1))-3)
strArray3 = split(strCodeText, "?", -1, 1)
if (UBound(strArray3)>0) then
strCodeText = strArray3(1)
strArray3 = split(strCodeText, "&", -1, 1)
for counter3 = 0 to UBound(strArray3)
strArray4 = split(strArray3(counter3), "=", -1, 1)
if (UBound(strArray4)=1)AND(LCase(strArray4(0))="v") then
strCodeText = strArray4(1)
exit for
end if
next
end if
end if
end if
strResultString = strResultString & roTag1 & strCodeText & rcTag1 & roTag2 & strCodeText & rcTag2 & strArray2(1)
else
strResultString = strResultString & strArray(counter2)
end if
next
strTempString = strResultString
strResultString = ""
end if
next
ReplaceYouTubeTags = strTempString
end function
%>
____________________________________
At line 239 change:
if strAllowForumCode = "1" then
fString = extratags(fString)
end if
____________________________________
to
____________________________________
if strAllowForumCode = "1" then
fString = extratags(fString)
fString = ReplaceYouTubeTags(fString)
end if
____________________________________
Now you can use the brand new forum code!
____________________________________
If you want, you can modify "pop_forum_code.asp",
adding the following code before if (strIMGInPosts = "1"), at line 158.
Response.Write "<p><b>YouTube:</b> Place the letter 's' after the http in the video URL (example https://www). Next, enclose the video URL with [youtube] and [/youtube] . <i>Example:</i> Here is a video: <b>[youtube]</b>http://www.youtube.com/watch?v=gJmX1z1NY2c<b>[/youtube]</b></p>" & vbNewLine
____________________________________
If you want a YouTube button, copy "icon_editor_youtube.gif" in your image folder
(if you have not an image folder, use the root folder of the forum).
____________________________________
Modify "inc_code.js" adding at the end:
function youtube() {
var text = getText();
if (helpstat){
alert("YouTube tag inserts a video hosted by YouTube into the post, but you will need to add the letter 's' after the http in your link.\n\nExample: [youtube]https://www.youtube.com/watch?v=gJmX1z1NY2c[/youtube]");
} else if (basic) {
AddTxt="[youtube]" + text + "[/youtube]";
AddText(AddTxt);
} else {
txt=prompt("YouTube video URL","");
if(txt!=null) {
AddTxt="[youtube]"+txt+"[/youtube]";
AddText(AddTxt);
}
}
}
____________________________________
Modify "inc_iconfiles.asp" adding (where you want):
Const strIconEditorYouTube = "icon_editor_youtube.gif|46|22"
____________________________________
Modify "inc_post_buttons.asp" adding after line 66, just before 'if lcase(strIcons) = "1" and strShowSmiliesTable = "0"':
Response.Write "<a href=""Javascript:youtube();"" tabindex=""-1"">" & getCurrentIcon(strIconEditorYouTube,"Insert YouTube","align=""top""") & "</a>" & vbNewLine
____________________________________
Ciao!
Luca Panella
http://www.lucapanella.com
Sep 01 2007
Snitz Member "webewitch" shared this below to allow full screen on YouTube video:
I've changed the code a wee bit to the now standard size of 640x390 and added the fullscreen button:
CodeTags(1,1,1) = "[youtube]"
CodeTags(1,2,1) = "[/youtube]"
CodeTags(1,1,2) = "<object width=""640"" height=""390""><param name=""movie"" value=""http://www.youtube.com/v/"
CodeTags(1,2,2) = "&fs=1""></param><param name=""allowFullScreen"" value=""true""></param><param name=""wmode"" value=""transparent""></param>"
CodeTags(1,1,3) = "<embed src=""http://www.youtube.com/v/"
CodeTags(1,2,3) = "&fs=1"" type=""application/x-shockwave-flash""allowfullscreen=""true"" wmode=""transparent"" width=""640"" height=""390""></embed></object>"
One slight problem I have is that while most of the videos work on my iPhone a few don't . e.g. this one;
[youtube]http://www.youtube.com/watch?v=o-WZU1X--IM[/youtube]
Function ReplaceYouTubeTags(fString)
fString=Replace(fString, "youtu.be/", "www.youtube.com/v/")
fString=Replace(fString, "watch?v=", "v/")
fString=Replace(fString, "https:", "http:")
For intFI = 1 to Len(fString)
If Mid(fString,intFI,9)="[youtube]" Then
intFJ=intFI+9
End If
If Mid(fString,intFI,10)="[/youtube]" Then
intFK=intFI
strMovLK = Mid(fString,intFJ,intFK-intFJ)
Exit For
End If
Next
Dim oTag, cTag
Dim roTag1, rcTag1, roTag2, rcTag2
Dim oTagPos, cTagPos
Dim nTagPos
Dim counter1, counter2, counter3
Dim strCodeText
Dim Tagcount
Dim strTempString, strResultString
TagCount = 1
Dim CodeTags(1,2,3)
Dim strArray, strArray2, strArray3, strArray4
CodeTags(1,1,1) = "[youtube]"
CodeTags(1,2,1) = "[/youtube]"
If Instr(strMovLK,"http") = 0 Then
CodeTags(1,1,2) = "<object width=""640"" height=""390""><param name=""movie"" value=""http://www.youtube.com/v/"
Else
CodeTags(1,1,2) = "<object width=""640"" height=""390""><param name=""movie"" value="""
End If
CodeTags(1,2,2) = "?autoplay=1"" /><param allowfullscreen=""true"" /><param wmode=""transparent"" />"
If Instr(strMovLK,"http") = 0 Then
CodeTags(1,1,3) = "<embed src=""http://www.youtube.com/v/"
Else
CodeTags(1,1,3) = "<embed src="""
End If
CodeTags(1,2,3) = "?autoplay=1"" type=""application/x-shockwave-flash"" allowfullscreen=""true"" wmode=""transparent"" width=""640"" height=""390""></embed></object>"
strResultString = ""
strTempString = fString
For counter1 = 1 To TagCount
oTag = CodeTags(counter1,1,1)
roTag1 = CodeTags(counter1,1,2)
roTag2 = CodeTags(counter1,1,3)
cTag = CodeTags(counter1,2,1)
rcTag1 = CodeTags(counter1,2,2)
rcTag2 = CodeTags(counter1,2,3)
oTagPos= InStr(1, strTempString, oTag, 1)
cTagPos= InStr(1, strTempString, cTag, 1)
If (oTagpos > 0) And (cTagPos > 0) Then
strArray = Split(strTempString, oTag, -1, 1)
For counter2 = 0 To UBound(strArray)
If (InStr(1, strArray(counter2), cTag) > 0) Then
strArray2 = Split(strArray(counter2), cTag, -1, 1)
strCodeText = Trim(strArray2(0))
If (LCase(Left(strCodeText,2))="<a") Then
strArray3 = Split(strCodeText, ">", -1, 1)
If (UBound(strArray3)>0) Then
strCodeText = Left(strArray3(1), Len(strArray3(1))-3)
strArray3 = Split(strCodeText, "?", -1, 1)
If (UBound(strArray3)>0) Then
strCodeText = strArray3(1)
strArray3 = Split(strCodeText, "&", -1, 1)
For counter3 = 0 To UBound(strArray3)
strArray4 = Split(strArray3(counter3), "=", -1, 1)
If (UBound(strArray4)=1) And (LCase(strArray4(0))="v") Then
strCodeText = strArray4(1)
Exit For
End If
Next
End If
End If
End If
strResultString = strResultString & roTag1 & strCodeText & rcTag1 & roTag2 & strCodeText & rcTag2 & strArray2(1)
Else
strResultString = strResultString & strArray(counter2)
End If
Next
strTempString = strResultString
strResultString = ""
End If
Next
ReplaceYouTubeTags = strTempString
End Function
Originally posted by bobby131313
I'm a purdy fart smeller.![]()
Originally posted by Carefree
This is untested, but you could try replacing the bit of code in "inc_func_common.asp" with something like this:
Note the bits in red. If you're running a secure forum, you'll have to switch the values in the replace and change the http to https twice in the second routine.
Also note the two bits in purple. If members post more than one video per topic (including replies), you need to change each 1 to 0. Otherwise, you'll get a mess of videos starting simultaneously.Code:Function ReplaceYouTubeTags(fString)
fString=Replace(fString, "youtu.be/", "www.youtube.com/v/")
fString=Replace(fString, "watch?v=", "v/")
fString=Replace(fString, "https:", "http:") For intFI = 1 to Len(fString)
If Mid(fString,intFI,9)="[youtube]" Then
intFJ=intFI+9
End If
If Mid(fString,intFI,10)="[/youtube]" Then
intFK=intFI
strMovLK = Mid(fString,intFJ,intFK-intFJ)
Exit For
End If
Next
Dim oTag, cTag
Dim roTag1, rcTag1, roTag2, rcTag2
Dim oTagPos, cTagPos
Dim nTagPos
Dim counter1, counter2, counter3
Dim strCodeText
Dim Tagcount
Dim strTempString, strResultString
TagCount = 1
Dim CodeTags(1,2,3)
Dim strArray, strArray2, strArray3, strArray4
CodeTags(1,1,1) = "[youtube]"
CodeTags(1,2,1) = "[/youtube]"
If Instr(strMovLK,"http") = 0 Then
CodeTags(1,1,2) = "<object width=""640"" height=""390""><param name=""movie"" value=""http://www.youtube.com/v/"
Else
CodeTags(1,1,2) = "<object width=""640"" height=""390""><param name=""movie"" value="""
End If
CodeTags(1,2,2) = "?autoplay=1"" /><param allowfullscreen=""true"" /><param wmode=""transparent"" />"
If Instr(strMovLK,"http") = 0 Then
CodeTags(1,1,3) = "<embed src=""http://www.youtube.com/v/"
Else
CodeTags(1,1,3) = "<embed src="""
End If
CodeTags(1,2,3) = "?autoplay=1"" type=""application/x-shockwave-flash"" allowfullscreen=""true"" wmode=""transparent"" width=""640"" height=""390""></embed></object>"
strResultString = ""
strTempString = fString
For counter1 = 1 To TagCount
oTag = CodeTags(counter1,1,1)
roTag1 = CodeTags(counter1,1,2)
roTag2 = CodeTags(counter1,1,3)
cTag = CodeTags(counter1,2,1)
rcTag1 = CodeTags(counter1,2,2)
rcTag2 = CodeTags(counter1,2,3)
oTagPos= InStr(1, strTempString, oTag, 1)
cTagPos= InStr(1, strTempString, cTag, 1)
If (oTagpos > 0) And (cTagPos > 0) Then
strArray = Split(strTempString, oTag, -1, 1)
For counter2 = 0 To UBound(strArray)
If (InStr(1, strArray(counter2), cTag) > 0) Then
strArray2 = Split(strArray(counter2), cTag, -1, 1)
strCodeText = Trim(strArray2(0))
If (LCase(Left(strCodeText,2))="<a") Then
strArray3 = Split(strCodeText, ">", -1, 1)
If (UBound(strArray3)>0) Then
strCodeText = Left(strArray3(1), Len(strArray3(1))-3)
strArray3 = Split(strCodeText, "?", -1, 1)
If (UBound(strArray3)>0) Then
strCodeText = strArray3(1)
strArray3 = Split(strCodeText, "&", -1, 1)
For counter3 = 0 To UBound(strArray3)
strArray4 = Split(strArray3(counter3), "=", -1, 1)
If (UBound(strArray4)=1) And (LCase(strArray4(0))="v") Then
strCodeText = strArray4(1)
Exit For
End If
Next
End If
End If
End If
strResultString = strResultString & roTag1 & strCodeText & rcTag1 & roTag2 & strCodeText & rcTag2 & strArray2(1)
Else
strResultString = strResultString & strArray(counter2)
End If
Next
strTempString = strResultString
strResultString = ""
End If
Next
ReplaceYouTubeTags = strTempString
End Function
NOTE: As of Jan 2015, Google (YouTube) is killing off the <object> method of playing YT videos in web pages. They want everyone to use IFrames instead. So if you want to continue displaying YT videos, we'll have to write some security code to preclude anything other than legitimate YT videos in an embedded IFrame.
Originally posted by MaGrahamHi MaGraham, I tried those "iframe" codes in my forum but they didn't work. Do you use a specific mod with which those codes work? As far as I can see, the "OnlineVideos MOD" in the snitzbit site is the only (?) mod for dislaying online videos in a snitz forum including from youtube, vimeo, etc. Is this the mod that you run the iframe codes with? I also tried the standalone youtube display codes ("tubeframe.asp") by Carefree but I couldn't make it work at all either with iframe codes or with [youtube] type codes. Maybe I should have cleared the lucapan's youtube codes first?
These codes below (for YouTube and Vimeo) work on my site using the [iframe][/iframe] codes, and they allow full screen.
[iframe]https://www.youtube.com/embed/r5L6QlAH3L4?color=ffffff" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen[/iframe]
[iframe]https://player.vimeo.com/video/214844648?color=ffffff" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen[/iframe]
If those codes, and possibly more for other video sites, could be incorporated into the video mods, oh how wonderful that would be! Just sayin'.![]()
Originally posted by HuwRAn example would be the youtube embeds in this page: https://goo.gl/5EAqYC In my computer, they run smoothly with fullscreen enabled in firefox but not in chrome, which I mostly prefer.
emviem, can you provide an example that doesn't work
this embedded video works in IE/Firefox and chrome using a very basic iframe setup
https://www.reddick.co.uk/Mvc/Topic/Posts/1085?pagenum=1&archived=0&terms=video
Originally posted by emviem An example would be the youtube embeds in this page: https://goo.gl/5EAqYC In my computer, they run smoothly with fullscreen enabled in firefox but not in chrome, which I mostly prefer.
Originally posted by emviem An example would be the youtube embeds in this page: https://goo.gl/5EAqYC In my computer, they run smoothly with fullscreen enabled in firefox but not in chrome, which I mostly prefer.