React Native Mobile App Development
June 3, 2026 1 min read

How to embed videos in react native expo apps

HS
HEMANT SINGH
Technical Writer & Educator
import { StatusBar } from 'expo-status-bar';
import { useState } from 'react';
import { StyleSheet, View, Text, SafeAreaView} from 'react-native';
import {WebView} from "react-native-webview";
export default function App() {

  const handleWebViewMessage=()=>{
    console.log("hello clicked");
  }

  return (
    <>
        <SafeAreaView style={styles.main_container}>
        <WebView
  source={{
    html: `
      <html>
        <head>
          <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
          <style>
            body {
              margin: 0;
              padding: 0;
              overflow: hidden;
            }
            iframe {
                    border: 0;
                    top: 0;
                    left: 0;
                    height: '56.25%';
                    width: '100%';
                  }
          </style>
        </head>
        <body>
        <div style="position:relative;padding-top:56.25%;"><iframe src="https://iframe.mediadelivery.net/embed/15567/3b2c1086-0e94-447f-84da-991d2e865184?autoplay=false&loop=false&muted=false&preload=true&responsive=true" loading="lazy" style="border:0;position:absolute;top:0;height:100%;width:100%;" allow="accelerometer;gyroscope;autoplay;encrypted-media;picture-in-picture;" allowfullscreen="true"></iframe></div>        
        </body>
      </html>
    `,
  }}
  style={{ flex: 1, backgroundColor: 'yellow' }}
  onMessage={handleWebViewMessage}
  allowsFullscreenVideo={true}
  javaScriptEnabled={true}
/>

        </SafeAreaView>
    </>
  );
}

const styles = StyleSheet.create({
  main_container: {
    flex: 1,
    paddingTop: 32,
    paddingHorizontal:10,
    backgroundColor: '#fff'    
  },
  video:{
    flex: 1,
    backgroundColor:'yellow'
  }  
});