Application in Ionic for streaming YouTube videos

I am facing an issue with my Ionic app that is deployed as a web app. The problem arises when displaying YouTube videos on different screen sizes. While the video fits perfectly on small screens and scrolling is smooth, it becomes problematic on larger desktop screens such as my laptop, where the video occupies too much space making it difficult to scroll. I have included screenshots for better understanding of both scenarios.

Below is a snippet from my video.html file:

<!-- Video player section -->
<div ng-show="showVideo" align="center" class="video-container">
 <iframe margin="0" padding="0" border="none" width="700" height="400" frameBorder="0"
  ng-src="{{exercise_video_url}}">
 </iframe>  
</div>

<div ng-show="!showVideo">
 <h4>You have already rated the exercise. A new intensity level will be used tomorrow.</h4>
</div>

This is how I have styled it in my style.css:

/* Styling the video iframe to fit on mobile devices */
.video-container {
 position: relative;
 padding-bottom: 56.25%;
 padding-top: 35px;
 height: 0;
 overflow: hidden;
}
.video-container iframe {
 position: absolute;
 top:0;
 left: 0;
 width: 100%;
 height: 100%;
}  

https://i.sstatic.net/T0VHr.jpghttps://i.sstatic.net/MEuTP.png

I am looking for suggestions on how to improve the display of the video on desktop screens by reducing its size and possibly centering it.

Answer №1

To make your video responsive, consider using a media query similar to the one below:

@media screen and (min-width: 1200px){
   .video-container iframe {
     position: absolute;
     top: 0;
     left: 12%;
     width: 75%;
     height: 100%;
   }  
}

Feel free to adjust the width and centering options for the video based on your specific needs. Hopefully, this solution works well for you. Best regards.

Answer №2

You might want to consider adding the following CSS code:

@media only screen and (min-width : 1224px) {
.video-wrapper iframe
{
  max-width: 800px;
  margin: 0 auto;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Transforming into a serialized division

I am working on creating a custom WISYWIG editor that generates a div with specific inner elements. The goal is to design the div (along with its inner structure), serialize it, store it in a database as a string or JSON format, and later insert it into th ...

Aligning an element perfectly at the top within a column

I have two columns side by side. The column on the left contains HTML that I cannot control. On the right side, I need to display a comment box that should align with the text clicked on the left hand side. Is it possible to position an element absolutely ...

Is it possible to generate React.js components using CDN links of our own creation?

My Next.js app features a Chatbot component that I want to make available for anyone to use on their own website by simply adding a script tag. If I place the component in my public folder for public access, how can I enable this functionality? I am looki ...

AngularJS and Ionic Framework - Click on a specific row to interact with it

I am struggling to open a new page when an item is touched in my HTML code. Despite trying multiple times, I can't seem to make it work and I'm at a loss as to why. Below is the snippet of my HTML: <!DOCTYPE html> <html> <hea ...

Issue with Angular 9 Json pipe not showing decimal values

My JSON data looks like this: this.data = {"eoiStatistics": [ { "dateRange": { "explicitStartDate": "1997-01-01T00:00:00", "explicitEndDate": "2019-07-01T00:00:00" }, "outstandingApplicationCount": 0.0, "pendingApplicationCount": 24.0, " ...

Troubles with CSS Selectors in Internet Explorer 6

When I tested my website on Internet Explorer 6, I noticed a problem with the global navigation. Specifically, when I clicked on the ABOUT ME page, the image in the navigation did not match the active page. Although CONTACT US was displayed instead of abou ...

Unable to position divs next to each other in Firefox, yet successfully achieved in Chrome

I have successfully placed two divs side by side using the following markup, as shown in image 1, but this layout only works on Chrome. However, Firefox renders it differently as seen in Image 2. Is this a known issue that I overlooked? How can I resolve t ...

Position a div in the center and add color to one side of the space

I am seeking a way to create a centered div with the left side filled with color, as shown in examples. I have devised two solutions without using flexbox, but both seem somewhat like hacks. body { margin: 0; padding: 0; } .header { width: ...

Error: The function modal() is undefined in the jQuery library

I am trying to open a modal on page load, but I encountered the following error: jquery.min.js:2 Uncaught TypeError: $(...).modal is not a function at HTMLDocument.<anonymous> ((index):491) at j (jquery.min.js:2) at k (jquery.min.js:2) Below is th ...

What is the reason behind Chrome's automatic scrolling to ensure the clicked element is fully contained?

Recently, I have observed that when performing ajax page updates (specifically appends to a block, like in "Show more comments" scenarios) Chrome seems to automatically scroll in order to keep the clicked element in view. What is causing this behavior? Wh ...

Having an issue where the Jquery clone function is only duplicating the content once. Looking to

I'm currently working on existing HTML table code. My goal is to copy the text from the 'th' header rows and paste them inside the corresponding td cells for each subsequent row. While I have successfully managed to copy the header row, it o ...

There could be something in my CSS code that doesn't belong

I'm currently enrolled in a course that requires completing a programming exercise for grading purposes. While I've had success with other exercises, this particular one is giving me trouble. Here are the issues I keep encountering: The labels m ...

What could be the reason for the items not appearing on my bootstrap toggler?

I recently started working with Bootstrap version 5 and I'm trying to implement a navbar toggler. However, when I click on the toggler button, no content is displayed. Here is the code I'm using: <nav class="navbar navbar-expand-lg na ...

Issue with the Animated Skill Bar not functioning properly when scrolling

I've been trying to implement an animated skill bar in my Portfolio using JQuery, but I'm facing some challenges. Despite following various tutorials, the code doesn't seem to work as expected. I've tried calculating section scroll posi ...

Using PHP to upload a lone image file to an FTP server

I'm feeling frustrated trying to achieve a simple task. I just want to create an HTML form and use PHP to upload the selected file to a specific directory on an FTP server, but for some reason it's not working as expected. Here is the HTML form ...

Why does this inner HTML table always adjust its width based on the content within it? Is there a way to make it match the width of its container instead

I'm not very familiar with HTML and CSS, and I've come across a problem. Here is the CSS structure in question: <!-- TECHNICAL REFERENCE: --> <div id="referenteTecnicoTab"> <table width="800px" class="standard-table-cls table-he ...

Detecting Collisions in a Canvas-Based Game

As part of my educational project, I am developing a basic shooter game using HTML5 canvas. The objective of the game is to move left and right while shooting with the spacebar key. When the bullets are fired, they travel upwards, and the enemy moves downw ...

Limits of the window in a d3 network diagram

I'm currently working with a network diagram that consists of circle elements and lines connecting them. However, I've run into an issue where sometimes there are so many circles that they extend beyond the edge of my screen (see image attached). ...

What is the correct method for handling images in HTML and CSS?

Hey there! Just playing around on jsfiddle and wanted to share this Destiny-inspired creation: http://jsfiddle.net/3mfnckuv/3/ If you're familiar with Destiny, you'll see the inspiration haha.. But here are a few questions for you: 1) Any ide ...

Exploring the interaction between Bootstrap and AngularJS in creating unique menu functionality

UPDATE: added JSFiddle link I am currently working on creating a dynamic menu or set of options that will be populated based on server requests. The data structure I am dealing with is as follows (some unnecessary data has been omitted): { "name" : ...