Author |
Topic |
MaGraham
Senior Member
USA
1297 Posts |
Posted - 19 June 2016 : 09:08:54
|
The YouTube videos are not displaying on my site. I'm not receiving an error. In a post only the link displays, and it displays like this below.
https://www.youtube.com/watch?v=eNxO9MpQ2vA?autoplay=0" />
Does anyone have any clue as to how to correct this?
Here are the YouTube codes from my inc_func_common.asp if someone, please, has time to look at this.
Function ReplaceYouTubeTags(fString)
fString=Replace(fString, "youtu.be/", "www.youtube.com/v/")
fString=Replace(fString, "watch?v=", "v/")
If InStr(fString, "[youtube]") > 0 Then 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=0"" /><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=0"" type=""application/x-shockwave-flash"" allowfullscreen=""true"" wmode=""transparent"" width=""640"" height=""390"" /></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
|
"Do all the good you can, by all the means you can, in all the ways you can, at all the times you can, to all the people you can, as long as ever you can." - John Wesley |
Edited by - MaGraham on 20 June 2016 00:32:08 |
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 20 June 2016 : 04:19:12
|
it is possibly related to the two ? in your url, there should normally be only one, the second ? should be an & I would think |
|
|
MaGraham
Senior Member
USA
1297 Posts |
Posted - 20 June 2016 : 06:57:49
|
No, that produced the same results, Huw.
|
"Do all the good you can, by all the means you can, in all the ways you can, at all the times you can, to all the people you can, as long as ever you can." - John Wesley |
|
|
MaGraham
Senior Member
USA
1297 Posts |
Posted - 20 June 2016 : 07:42:35
|
I removed what you see in red below (the first "?autoplay").
CodeTags(1,2,2) = "?autoplay=0"" /><param allowfullscreen=""true"" /><param wmode=""transparent"" />"
The videos now display. They also play just fine. However, the YouTube video link displays just above the video in the post, when obviously there shouldn't be a link displaying in the post. I tried adding an & instead of the ? in the second "&autoplay" but that didn't change the results.
|
"Do all the good you can, by all the means you can, in all the ways you can, at all the times you can, to all the people you can, as long as ever you can." - John Wesley |
Edited by - MaGraham on 20 June 2016 07:52:43 |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 22 June 2016 : 07:30:44
|
could you post the RAW (unconverted forumcode) of a post inquestion, together with a screenshot of what it is displaying, seems that it is not parsing the tags correctly |
|
|
MaGraham
Senior Member
USA
1297 Posts |
Posted - 22 June 2016 : 18:29:17
|
Here's the forum code from one of the posts, Huw.
[youtube]https://youtu.be/nXgc0QJ_tiU[/youtube]
It's no longer displaying the part below in red after the post is submitted: https://youtu.be/nXgc0QJ_tiU?autoplay=0" />
In the post the YouTube link is displayed exactly like this below: https://youtu.be/nXgc0QJ_tiU And then the video is displayed directly below the link in the post.
Here's my codes again from my inc_func_common.asp so you can see the changes I've made.
Function ReplaceYouTubeTags(fString)
fString=Replace(fString, "youtu.be/", "www.youtube.com/v/")
fString=Replace(fString, "watch?v=", "v/")
' If InStr(fString, "[youtube]") > 0 Then fString=Replace(fString, "http", "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=""https://www.youtube.com/v/"
Else
CodeTags(1,1,2) = "<object width=""640"" height=""390""><param name=""movie"" value="""
End If
CodeTags(1,2,2) = "<param allowfullscreen=""true"" /><param wmode=""transparent"" />"
If Instr(strMovLK,"http") = 0 Then
CodeTags(1,1,3) = "<embed src=""https://www.youtube.com/v/"
Else
CodeTags(1,1,3) = "<embed src="""
End If
CodeTags(1,2,3) = "?autoplay=0"" type=""application/x-shockwave-flash"" allowfullscreen=""true"" wmode=""transparent"" width=""640"" height=""390"" /></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
We can live with the link displaying within the post now that the video finally displays (and plays fine). Needless to say, it's really odd that the link displays along with the video.
|
"Do all the good you can, by all the means you can, in all the ways you can, at all the times you can, to all the people you can, as long as ever you can." - John Wesley |
Edited by - MaGraham on 23 June 2016 06:56:39 |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 23 June 2016 : 07:28:46
|
I'll take a peak at the code later and see if I can see why it is showing the link as well |
|
|
volkerc
Junior Member
Germany
156 Posts |
Posted - 16 August 2016 : 04:23:09
|
Seems that you tube is no longer supporting flash, instead they support html5. How can we still have the videos displayed in the forum?
|
|
|
bobby131313
Senior Member
USA
1163 Posts |
Posted - 16 August 2016 : 17:56:04
|
Is this what some users are seeing?
So far my preliminary findings are that all users that see this are using Chrome/52. |
Switch the order of your title tags |
|
|
golfmann
Junior Member
United States
450 Posts |
Posted - 16 August 2016 : 18:43:41
|
That's what I get too.. on Maxthon (uses Chrome engine) and Chrome... Firefox works ok. |
Edited by - golfmann on 16 August 2016 18:47:10 |
|
|
bobby131313
Senior Member
USA
1163 Posts |
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
|
bobby131313
Senior Member
USA
1163 Posts |
Posted - 16 August 2016 : 20:56:11
|
I think Chrome has abandoned flash starting with version 52. What I've seen so far is if you use the iframe code it will default to html5, embed code will not and fails. |
Switch the order of your title tags |
|
|
golfmann
Junior Member
United States
450 Posts |
Posted - 16 August 2016 : 21:34:18
|
YouTube has dropped flash, I think. All html5 now. Since Chrome owns youtube, it's all kind of crazy to me but I'm old and don't know better :)
I guess ideally, things need to be re-written in HTML5 with the <video> </video>... ??? I'll get right on it. (not) |
Edited by - golfmann on 17 August 2016 00:49:44 |
|
|
bobby131313
Senior Member
USA
1163 Posts |
Posted - 17 August 2016 : 09:42:36
|
The iframe code will default to html5. I replaced my code in inc_func_common.asp with this...
CodeTags(1,1,1) = "[youtube]"
CodeTags(1,2,1) = "[/youtube]"
CodeTags(1,1,2) = "<div class=""youtube""><iframe width=""100%"" height=""100%"" src=""https://www.youtube.com/embed/"
CodeTags(1,2,2) = """ frameborder=""0"" allowfullscreen>"
CodeTags(1,1,3) = "</iframe>"
CodeTags(1,2,3) = "</div>"
And put this in my CSS file...
.youtube {
margin:10px;
max-width:600px;
width:95%;
height:400px;
max-height:100%;
font-size:0px
}
Everyone is reporting it working fine and it will shrink fairly gracefully on small screens.
There is a bug which the CSS hides though. The video ID shows under the video and I couldn't fix it so the CSS hides it. |
Switch the order of your title tags |
Edited by - bobby131313 on 17 August 2016 09:43:23 |
|
|
golfmann
Junior Member
United States
450 Posts |
Posted - 17 August 2016 : 16:32:22
|
I don't understand though why they work fine in Firefox...
(still fiddling with mine. I have Marcell's old code and trying to clean it up for just youtube) NOT fun :) |
|
|
Topic |
|
|
|