MyBB Community Forums

Full Version: Embedded Video With HTML Not Working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using the following code to try and embed a video from an external server and my result is the frame loading but not the video:
<video width="640" height="480" controls="controls">
<source src="http://files.animeget.org/HxH/HxH_01_HD.mp4" type="video/mp4">
</video>

I DID enable HTML in the forum I am posting it in.
I have a BB Code that let's users embed a FireDrive video into their post. It works without any problems. Make sure that the video host doesn't have hotlink protection enabled.

Also, http://www.w3schools.com/tags/tag_video.asp
Controls is like a boolean value. It doesn't take any arguments, so if it is present in the tag, then controls is true <video controls>. If it's not present in the tag, the value is false <video>. And the XHTML version screws up everything if the page isn't XHTML compliant <video controls="controls">.
(2014-06-22, 01:12 AM)Vashnik Wrote: [ -> ]I have a BB Code that let's users embed a FireDrive video into their post. It works without any problems. Make sure that the video host doesn't have hotlink protection enabled.

Also, http://www.w3schools.com/tags/tag_video.asp
Controls is like a boolean value. It doesn't take any arguments, so if it is present in the tag, then controls is true <video controls>. If it's not present in the tag, the value is false <video>. And the XHTML version screws up everything if the page isn't XHTML compliant <video controls="controls">.

Ok, controls were working just fine though.
Video is still not playing. It's basically just a file uploaded onto a dedi server of mine.

Also note that the video loads perfectly fine in another page of the site that isn't connected to MyBB.
Found it. Here is the source shows when posted:
<video width="640" height="480" controls="controls"><br />
&lt;source src=&quot;http://files.animeget.org/HxH/HxH_01_HD.mp4&quot; type=&quot;video/mp4&quot;&gt;<br />
</video>

However, if you turn it into a MyCode, it should work without any problems and you don't leave your forum as exposed to security holes when allowing HTML. At least in the Admin CP it works. Posting still returns the same problem, if HTML is turned on.
Expression:
\[video=(.*?)\](.*?)\[/video\]

Source:
<video width="640" height="480" controls="controls">
<source src="$2.$1" type="video/$1">
</video>

Because the <source> tag is being caught by the HTML filter to replace <script> and <style> tags, I can see that it could possibly look like a bug when posting with HTML instead of MyCode. However before HTML5, it worked as intended. So a staff will have to decide whether it really is a bug or it is working as intended considering HTML5 is fairly new, at least compared to 1.6. This might get fixed in 1.8 since it is gearing up for release (already public beta version 1).

Here is the filter, located in inc/class_parser.php starting on line 112 (roughly):
if($this->options['allow_html'] != 1)
		{
			$message = $this->parse_html($message);
		}
		else
		{		
			while(preg_match("#<s(cript|tyle)(.*)>(.*)</s(cript|tyle)(.*)>#is", $message))
			{
				$message = preg_replace("#<s(cript|tyle)(.*)>(.*)</s(cript|tyle)(.*)>#is", "&lt;s$1$2&gt;$3&lt;/s$4$5&gt;", $message);
			}

			$find = array('<?php', '<!--', '-->', '?>', "<br />\n", "<br>\n");
			$replace = array('&lt;?php', '&lt;!--', '--&gt;', '?&gt;', "\n", "\n");
			$message = str_replace($find, $replace, $message);
		}
(2014-06-22, 05:21 AM)Vashnik Wrote: [ -> ]Found it. Here is the source shows when posted:
<video width="640" height="480" controls="controls"><br />
&lt;source src=&quot;http://files.animeget.org/HxH/HxH_01_HD.mp4&quot; type=&quot;video/mp4&quot;&gt;<br />
</video>

However, if you turn it into a MyCode, it should work without any problems and you don't leave your forum as exposed to security holes when allowing HTML. At least in the Admin CP it works. Posting still returns the same problem, if HTML is turned on.
Expression:
\[video=(.*?)\](.*?)\[/video\]

Source:
<video width="640" height="480" controls="controls">
<source src="$2.$1" type="video/$1">
</video>

Because the <source> tag is being caught by the HTML filter to replace <script> and <style> tags, I can see that it could possibly look like a bug when posting with HTML instead of MyCode. However before HTML5, it worked as intended. So a staff will have to decide whether it really is a bug or it is working as intended considering HTML5 is fairly new, at least compared to 1.6. This might get fixed in 1.8 since it is gearing up for release (already public beta version 1).

Here is the filter, located in inc/class_parser.php starting on line 112 (roughly):
if($this->options['allow_html'] != 1)
		{
			$message = $this->parse_html($message);
		}
		else
		{		
			while(preg_match("#<s(cript|tyle)(.*)>(.*)</s(cript|tyle)(.*)>#is", $message))
			{
				$message = preg_replace("#<s(cript|tyle)(.*)>(.*)</s(cript|tyle)(.*)>#is", "&lt;s$1$2&gt;$3&lt;/s$4$5&gt;", $message);
			}

			$find = array('<?php', '<!--', '-->', '?>', "<br />\n", "<br>\n");
			$replace = array('&lt;?php', '&lt;!--', '--&gt;', '?&gt;', "\n", "\n");
			$message = str_replace($find, $replace, $message);
		}

Thanks for the help, it's still not working even when being embedded with MyCode.

Thread example: https://animeget.org/forums/showthread.p...d=34#pid34
(2014-06-22, 06:25 PM)Saturday Wrote: [ -> ]Thanks for the help, it's still not working even when being embedded with MyCode.

Thread example: https://animeget.org/forums/showthread.p...d=34#pid34
I tested it on a fresh install on localhost and it works. It's important to make sure you turn HTML off for the forum you are using the MyCode in.
The MyCode should be used like this:
[video=mp4]http://domain.tld/folder/file[/video]
No extension required since it is handled when you open the tag.

Also, I'm getting a 404 message. Did you accidentally delete the entire /forums/ folder for your MyBB installation?