How to create a custom frame for Youtube embedded player? - html

i'm developing a website in which i want to show videos from youtube (using the embedded player offered from YT) modifying the frame outside the player.
More specific, i want to create a television img in which, instead of the tv screen, i want to show my videos.
I've tried to create a photo from photoshop cancelling the screen, but then, in HTML, if i choose that img as background-div photo or inserting it as < img src="" />, using z-indexes, i cannot click on the "play" button of my video, because it is covered by the "television" div.
Any Help??

You could slice up your image into a top/left/right/bottom section, and place them around the youtube video (overlaying the edges of the youtube player)
I've mocked up a jsfiddle that uses background-color instead of the sliced up images.
HTML:
<div id="TV">
<div id="top"></div>
<div id="left"></div>
<div id="right"></div>
<div id="bottom"></div>
<div id="playButton">play<div>
</div>
CSS:
#TV{position:absolute;width:500px;height:300px;}
#top{position:absolute;top:0;width:500px;height:20px;background-color:red;}
#left{position:absolute;top:0;left:0;width:20px;height:300px;background-color:red;}
#right{position:absolute;top:0;right:0;width:20px;height:300px;background-color:red;}
#bottom{position:absolute;bottom:0;width:500px;height:20px;background-color:red;}
#playButton{height:100px;width:100px;border-radius:100px;background-color:yellow;left: 200px;position: absolute;top: 90px;}
#playButton:hover{background-color:red;}
I also have an example of this in action, where you would draw on the canvas in the middle of the "frame" images. Here
The only caveat is that you need to use fixed heights and widths, and absolute positions.

This is a code html with it you can insert a YT video
<iframe src="https://www.youtube.com/embed/5L3wKniOnro?autoplay=1" width="600" height="400" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Related

How to play a youtube video when an image is clicked in angular

I am developing a website where-in, i want a youtube video to be played when i click on the image. I don't want to go to the new tab for playing the video.
And I want the video to be placed exactly in the background of the image. When i click the image, the video should be played hiding the image.
Can anyone suggest me how to achieve this using html, css
You can simply add a property, which you can set as a boolean or any. Then you can create a method() to change the value of that property by clicking.
export class AppComponent {
isVideo : any = {};
OnChange(){
this.isVideo = !this.isVideo
}
}
Then in the template you can make 2 divs. One div contains your image. Other will contain video. Then you can use *ngIf="isVideo" to switch the div on click.
<div class="video" *ngIf="isVideo">
<img
src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg"
alt=""
(click)="OnChange()"
/>
</div>
<div class="video" *ngIf="!isVideo">
<iframe
src="https://www.youtube.com/embed/OP7IdmB9Dlg?autoplay=1&loop=1&autopause=0&muted=1"
allow="autoplay"
width="640"
height="360"
frameborder="0"
webkitallowfullscreen
mozallowfullscreen
allowfullscreen
>
</iframe>
</div>
Here is the working Demo.
Note : You can also disable the autoplay function of the video if you want.

google map don't active when take z-index:-1

I want to solve the problem in Google Map when I do z-index: -1 Do not activate the map but the div is above the map as I want ... I want to activate the map with the div remains above the map
<div id="map" style="z-index: -1;"></div>
<div id="filter-div-for-sale-mobile" style="transform-origin: left 78.5px;top: 39px;left: -273.61px;width:360.5px;" class="zsg-popover_arrow-up zsg-popover-adjustable popover-thick-top popover-no-close popover-visible filter-button-popover listing-type-popover">
I would recommend using the iframe option provided by Google as it is much more controllable in regards to the CSS styling perspective of making it responsive on a page.
Sample of what I mean. (the width and height for the iframe attribute aren't required)
<iframe width="600" height="450" frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/view?zoom=10&center=51.5074%2C-0.1278&key=..." allowfullscreen></iframe>
It could be helpful to include the position of your element (fixed,relative or absolute ) etc.
Also what browser are you using?

Changing position of embeded youtube video in CSS

This is my first time posting here and don't really know much about web coding or CSS. I'm a CGI artist who is trying to implement a simple feature. I would like to showcase my Demoreel on my website, figured out how to add the video in, but the position is on the far left of the screen. I'm using Artstation web builder, they don't have an option to implement the video visually. I like to place it in the middle of the screen for the website before showcasing projects since its a built website there are lots of coding and hopping can implement the position code in the middle of without adding in an extra function and such.
I'm using the Firefox Inspector to change the coding when trying to add a position just add a text rather the action on the website.
Any answers regarding to this are very appreciated
Thanks!
<div>
<iframe src="https://www.youtube.com/embed/Ywzukda7WsI" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" width="560" height="315" frameborder="0">
</iframe>
</div>
What it looks like now on the website
In the iframe, add:
<iframe style='display: block; margin: 0 auto;'>
And that should work.
I tried it on JSFiddle:
https://codepen.io/Rohittt/pen/eQwLYe
you can just copy the code from here or the JSFiddle!
Hope I helped you!

Entering HTML text into an iframe

Is it possible to add "sub-text" to an iframe? For example I have the following code...
<iframe class="musicsamples" width="80%" height="315" src="http://www.youtube.com/embed/apkRBANIKxc" frameborder="0" allowfullscreen></iframe>
<iframe class="musicsamples" width="80%" height="315" src="http://www.youtube.com/embed/h7ArUgxtlJs" frameborder="0" allowfullscreen></iframe>
And I want to be able to add some text beneath that explains in detail the video etc, but whenever I've used a simple tag within or just outside of the iframe, it treats it as if the iframe isn't present and the text always appears at the top of the page instead of beneath the iframe. Maybe I need to embed this video in some other way other than an iframe in order to be able to use text along with it?
I'm not sure what isn't working for you, maybe your CSS is messing it up?
I was able to use the iframes of the videos and add a little description to them. Here is a sample, it's also on jsFiddle
<div>
<iframe class="musicsamples" width="80%" height="315" src="http://www.youtube.com/embed/apkRBANIKxc" frameborder="0" allowfullscreen></iframe>
<p>Pharoahe Monch Simon Says (Avicii Remix)</p>
</div>
<div>
<iframe class="musicsamples" width="80%" height="315" src="http://www.youtube.com/embed/h7ArUgxtlJs" frameborder="0" allowfullscreen></iframe>
<p>deadmau5 feat. Rob Swire - Ghosts N Stuff</p>
</div>

set external link to youtube iframe video

I am using iframe you-tube video in my website.
Sample Code:
<iframe width="414" height="270" src="samplecode" frameborder="0" allowfullscreen></iframe>
If I click the youtube video it will redirect to the external page. I used the below code.
<iframe width="414" height="270" src="samplecode" frameborder="0" allowfullscreen></iframe>
I know my way is wrong. It is not working. Please confirm to do this in anyway?
This will not work. To solve your problem you have to use javascript. For reference you can check following thread
Detect Click into Iframe using JavaScript
Another Solution is
<div style="position:relative">
<div style="position:absolute;width:414px;height:270px" onclick='window.location.href="http://google.com"' ></div>
<iframe width="414" height="270" src="samplecode" frameborder="0" allowfullscreen></iframe>
</div>
Here I superimposed another div overiframe (we will not set any background for it, so iframe content will be seen) which will have onclick function which will take user to desired url