Embeded YouTube video not available in iframe HTML
YouTube forbids embedding some videos in a localhost environment
without a public domain, but your video can be embedded with no issue through a public domain/ sub-domain
try the same using webhosting apps or online html tools.
My youtube embed code doesn't work on html website
You have to enable embedding first before the embed
code will work from other websites.
- Log in to https://www.youtube.com/my_videos?o=U
- Click
Edit
on the video you want to embed - Click on
Advanced Settings
in the tab below - Click
Allow Embedding
to enable it under theDistribution options
section. - Click
Save Changes
to save the new configuration. - Now your embed link is ready to be embedded on other websites!
Embedded YouTube video doesn't work on local server
Sergiy Shcherbina's answer helped me solve this issue. I was running my web server from a vm and accessing it through my local IP address.
It seems that you need to access your page that contains the embedded youtube player through a host name and NOT an IP address.
How I solved This for my dev environment
Before the change, I was accessing my web-page like this: http://192.168.x.x:3000/video
and i would get 'video unavailable' errors for many videos that were verifiably 'embeddable'.
A Hacky word-around: I set a hostname for my VM in my hosts file and aliased my IP address to dev-vm
. How to edit your host file
Now i access the page which has my embedded player like this: http://dev-vm:3000/video
and now videos that previously gave me a 'video unavailable' error are now playing.
What a bizarre issue. I hope this helps some people who are having a similar issue.
HTML: Input YouTube Video embed link not working
Regular Expressions can be useful for this kind of validation.
For client-side validation:
function validateYoutubeURL(url){
var regex=/https?:\/\/youtu(be\.com|\.be)\/.+/;
return regex.test(url.toLowerCase());
}
And for server-side validation:
public function store(Request $request){
$this->validate($request, [
'field_name'=> [
'required',
'regex:/https?:\/\/youtu(be\.com|\.be)\/.+/',
]
]);
}
In order to notify user about wrong URL, use this (Server-Side validation):
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
Important:
Note: When using the regex / not_regex patterns, it may be necessary to specify rules in an array instead of using pipe delimiters, especially if the regular expression contains a pipe character.
For third part of your question, please post your view and controller.
Related Topics
How to Semantically Provide a Caption, Title or Label for a List in HTML
How to Change One Word Color of Placeholder
How to Position a Table at The Center of Div Horizontally & Vertically
Height Is Not Correct in Flexbox Items in Chrome
Centering a Div Between One That's Floated Right and One That's Floated Left
Font Size with Percentage Value (%) Not Scaling with Screen Size
CSS Border on Png Image with Transparent Parts
What Are The Default Values for Justify-Content & Align Content
Is The Copyright Meta Tag Valid in HTML5
CSS Changes Are Not Getting Reflected. Why
Make a Perfect Circle Around a Div of Variable Height
Websocket Server Implementations for Delphi
Bootstrap 5 Layout for Different Sizes Cards - Like Pinterest
Is It Better to Wrap The Label Tag Around a Form Item or Use The "For" Attribute in HTML
Bootstrap Row and Col Explanation
How to Select Multiple Elements in The Chrome Developer Tools Elements Panel