Skip to content

Auto play not working in android 16 #378

@tvone

Description

@tvone

Describe the bug
A clear and concise description of what the bug is.
Auto play not working in android 16

To Reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] : Google Pixel 9 pro
  • OS + version: [e.g. iOS 13.5 | Android 10] Android 16
  • react-native-youtube-iframe version 2.4.1
  • react-native-webview version: 13.13.5
  • Expo verison [if using expo]: ~53.0.12

Additional context
Add any other context about the problem here.

import React, { useCallback, useEffect, useState } from "react";
import YoutubePlayer from "react-native-youtube-iframe";

export default function TestYoutube() {
const [playing, setPlaying] = useState(true);

const onReady = useCallback(() => {
console.log("Player is ready");
setPlaying(true);
}, []);

const onChangeState = useCallback((state: string) => {
console.log("Player state:", state);
}, []);

useEffect(() => {
console.log(playing);
}, [playing]);

return (
// <View style={{ flex: 1, justifyContent: "center" }}>
<YoutubePlayer
height={250}
width="100%"
play={playing}
videoId="3yvyw2JWIVk"
forceAndroidAutoplay={true}
onReady={() => {
setPlaying(true);
}}
initialPlayerParams={{ controls: false, loop: true }}
webViewProps={{ onLoad: () => setPlaying(true) }}
onChangeState={onChangeState}
/>
//
);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions