The purpose is to create an Adalo Component that can play in the background.
In other words, I want the audio of the video to play even when the screen is locked or moved to another app in iOS app or Android.
There is already a component named “Plyr Video” created by miniflow in the Marketplace.
However, “Plyr Video” can not support the continuous video playing when closing an app.
Therefore, I would like to create a my own Adalo Component.
here’s what i did
npx create-adalo-component my-component
cd my-component
npx adalo login
npm install react-native-video --save
npx adalo dev
And my code (src/index.js)
import React, { Component } from 'react'
import { View, StyleSheet } from 'react-native'
import Video from "react-native-video";
class AdaloCompnent extends Component {
render() {
return (
<View style={styles.wrapper}>
<Video
source={{ uri: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4' }}
style={{ width: 300, height: 300 }}
controls={true}
ref={(ref) => {
this.player = ref
}} />
</View>
)
}
}
const styles = StyleSheet.create({
wrapper: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}
})
export default AdaloCompnent
The error occured when I execute npx adalo dev
. The error messages as below:
ERROR in ./node_modules/react-native-video/Video.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/takehirotakiuchi/Desktop/adalo-component/node_modules/react-native-video/Video.js: Unexpected token (78:24)
76 | };
77 |
> 78 | save = async (options?) => {
| ^
79 | return await NativeModules.VideoManager.save(options, findNodeHandle(this._root));
80 | }
If you notice anything, please let me know.