2

I have converted an HTML template to React js and now I am not able to play the video, have give the attribute autoPlay="true". Still its not working. Can anyone please help me with this?

Below is my video-player code:

       return(
            <div>
                <video width="400" controls autoPlay="true">
                <source src="mov_bbb.mp4" type="video/mp4"/>
                <source src="mov_bbb.ogg" type="video/ogg"/>
                Your browser does not support HTML video.
            </video>
            <p>
            Video courtesy of 
            <a href="<network url of video>" target="_blank">Video is Playing</a>.
            </p>
            </div>
        );

The player is opening but none of the controls are working nor the video is playing. Did I miss to add any package or tag>? Please let me know.

1

1 Answer 1

4

Chrome stops auto play of all video having audio turned on so you add muted attribute , also add playsinline attribute to play in safari

<video width="400" controls autoPlay={true} muted playsInline >
                <source src="mov_bbb.mp4" type="video/mp4"/>
                <source src="mov_bbb.ogg" type="video/ogg"/>            
</video>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.