Autoplay Configuration
Video autoplay is a feature in web development that automatically starts playing a video as soon as a webpage is loaded.As video continues to play an increasingly important role in digital media, understanding how to properly implement video autoplay is becoming increasingly important for web developers.
The implementation of autoplay feature can be done in Lura Player using the following configuration.
Attribute | Type | Description |
---|---|---|
autoplay | boolean | Autoplay attribute of the player. Default is false (If set to true, muted attribute might be set to true on some platforms where unmuted autoplay is not supported) |
muted | boolean | Whether to start muted when the player autoplays. Default is false |
import React, { useRef } from "react";
import { LuraPlayer, LuraPlayerProps } from "lura-react-native-core";
export default function MySampleComponent() {
const playerRef = useRef<LuraPlayer>(null);
const config = {
token:
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2aWQiOiI0MzY2NjIzIiwiaXNzIjoiM1FMWjdaV0JsRko1Vk16Y2pyczJPbTd3VTdEanIzNFkifQ.CruM1W3gIEyQTBTqfaY5gTdf7b_2SSNg4gj6JGOj4Mg",
autoplay: true,
muted: true,
};
return (
<View>
<LuraPlayer ref={playerRef} config={config} />
</View>
);
}