Adjusting Opentok React video to utilize the complete height of the encompassing container

I'm currently utilizing https://www.npmjs.com/package/opentok-react within my application and setting up a publisher and subscriber in a specific div. This is the CSS I have implemented:

#videos {
    position: fixed;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    z-index: -100;
    min-width: 100%;
    min-height: 100%;
    overflow: hidden;
    //min-height: 720px;
    //margin-left: auto;
    //margin-right: auto;
}
#subscriber {
    position: relative;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}
#publisher {
    position: absolute;
    width: 360px;
    height: 240px;
    bottom: 10px;
    right: 10px;
    z-index: 100;
    border: 3px solid white;
    border-radius: 3px;
}

The issue arises when I provide the subscriber component with the props width 100% and height 100%, it does not behave as expected. Instead of conforming to the full width and height of the container div with the #subscriber id selector, it behaves differently. On the other hand, if I specify the props using a pixel value, it works properly. How can I ensure that the subscriber video component adjusts to the size of the container div based on a percentage?

Answer №1

Greetings from the TokBox Developer Evangelist!

When setting up publishers and subscribers using the Opentok-React library, make sure to utilize the OTPublisherContainer and OTSubscriberContainer classes provided for styling purposes. Check out how this is implemented in the library code:

An issue has been raised on the repository to enhance documentation related to styling techniques.

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

Include an additional title to the header of the Bootstrap 4 modal

Currently, I am utilizing a basic modal window which was constructed from Bootstrap's (4.4) sample. This modal consists of a header division: <div class="modal-header"> <h5 class="modal-title">Modal title</h5> <button ty ...

"The issue mentioned earlier happened within the paragraph component" - Troubleshooting array mapping in React

Struggling to figure out why the mapping of array objects won't display correctly in the scrimba mini-browser. Although I can see the array object with console.log, nothing appears on the browser. Any ideas on what I might be missing? Thanks. import ...

I've been encountering issues when trying to use useForm and react-hook-form in conjunction with NextJs

Struggling with using 'useForm' in my NextJs project. The error message "Cannot resolve 'react-hook-form'" keeps popping up. Any ideas on how to solve this issue? import React from "react"; import { useForm } from "react- ...

When trying to convert a function component to a class component, using `npm init react-app` may result in the error `ReferenceError: React is not defined no-undef`

After running npm init react-app appname, I noticed that the file App.js was created, containing a function component: function App() { return ( <SomeJSX /> ); } I decided to change this function component into a class component like this: c ...

What is the best method for disabling autoscroll for a specific div id when the :target attribute

I created this accordion menu using only html and css, but the buttons are built with the :target id. Is there a way to prevent the automatic scrolling when any button is clicked without using javascript? It currently moves to the anchor #id. I've se ...

Can the value of a variable be passed as seen in the JavaScript code snippet?

I'm wondering if I'm on the right track with generating random colors when a button is clicked. Here's my code: randomColor = "#" + Math.floor(Math.random() * 16777215).toString(16); // --- more code --- changeHeaderColor() { con ...

How does thinking in ReactJS differ for someone with an AngularJS background?

Although I have experience with AngularJS, I am eager to dive into the world of ReactJS. I'm particularly intrigued by ReactNative and its potential to transform mobile apps. Can you explain how the mindset and architecture of a React application co ...

As I run the npm build command, I expect the resulting build to include my specific file

Is there a way to include the web.config file in the build directory generated by npm? ...

Tapping the image will redirect you to the corresponding component

My React Routes Challenge I've run into a roadblock while trying to implement react routes in my project. Greetings, everyone! This is my first time seeking help here, as I have previously posted about this issue on Codecademy. Below is the summary o ...

When updating the state of a deeply nested component in React, does React perform a diffing operation on the entire root tree or just on the specific deep

The App component serves as the main component of the project, with the Dog component being its descendant. When the Dog component's own state changes, how does React handle the diffing process? Does React compare the new and old tree structure of the ...

Creating interactive links in Next.JS with the help of styled-components

While working on a small side project, I encountered an issue with active links in my navbar using Next.JS. In React, you can easily use react-router-dom and its Link component with the activeclass attribute, but it seems like this feature is not availab ...

What is the best method for adjusting the initial cursor position in a text field component of Material UI (Version 5.14.6)?

Is there a way to adjust the starting position of the cursor in a text field component using Material UI? In our project, we are working with the latest version of Material UI and utilizing the TextField component. However, we have noticed that the cursor& ...

Issues with aligning text in a flexbox using Bootstrap 4's text-center property

I am currently working on a project to create a webpage with two vertical columns that are clickable and lead to different pages. Here is what I have so far. HTML <!-- Choices --> <div class="container-fluid"> <div class="row"> ...

What is the procedure to alter the color of XYChart in JavaFx?

How can I change the color of a bar chart? Does anyone have any tips on: How to adjust the color of line charts? How to assign a CSS class to series? public class CustomBarChart extends Application { @Override public void start(Stage stage) throws Ex ...

Using React to create multiple modals and dynamically passing props

Each item in my list (ProjectActivityList) has an Edit button which, when clicked, should open a modal for editing that specific item. The modal requires an ID to identify the item being edited. var ProjectActivities = React.createClass({ onEditItem: ...

Can Jquery use .hover to add a class or Child:hover to impact its parent element?

I have been searching for a solution tailored to my specific needs, and I am encountering difficulties in getting a seemingly simple jQuery code to function as expected. Here is the link to my basic fiddle: http://jsfiddle.net/LBHxc/ (I apologize for the ...

Outlook's limited width is causing images to exceed the boundaries of the HTML email

I have a collection of images that display perfectly in Gmail, but when viewed in Outlook, all five images appear within a single <tr> and cause the table width to expand. My desired layout is to have the first four images centered on the first line ...

Issue with React: Token is not defined, even though the token is accessible in Postman

When using an app.get('/jwtid') route to capture the token on my home React app, everything appears to work fine with Postman and my server successfully sends me the token. However, when I attempt a get request with axios in React, the token rece ...

Transitioning Opacity in CSS

I found inspiration for my project from the following source: https://codepen.io/plavookac/pen/qomrMw One challenge I'm facing is changing the opacity of the movement, which is not covered by the standard transition markers. .mainInner{ display ...

Is there a way to modify the overflow/wrap direction on small screens for just one Bootstrap column?

With a bootstrap row containing two columns on large screens (referred to as Text 2 and Image 2 below), the layout wraps on small screens, making Text 2 appear above and Image 2 below, which is the default behavior. However, if I wish to have Image 2 displ ...