У меня есть приложение реагирования, которое вытянет список ключей из s3, а затем перебирает их и получает необходимые ссылки.Мне нужно использовать ссылки, сгенерированные в части рендеринга моего приложения, чтобы показать видео.
import Amplify from "aws-amplify";
import { Storage} from 'aws-amplify'
import React, {Component} from 'react'
import ReactPlayer from 'react-player'
import { withAuthenticator} from "aws-amplify-react";
import config from "./aws-exports";
Amplify.configure(config);
const result = ""
class App extends React.Component {
onChange(e) {
const file = e.target.files[0];
const filename = e.target.files[0].name;
console.log("filename", filename)
Storage.put(filename, file, {
contentType: 'video/mp4'
})
.then(result => console.log(result))
.catch(err => console.log(err));
}
render() {
Storage.list('', {
level: 'public'
})
.then((result) => {
Storage.get(result[1].key, {
level: 'public'
})
.then((result) => {
})
.catch((err) => {
console.log(err);
})
})
return (
console.log("result", result), <
ReactPlayer url = {
result
}
playing / >
)
}
}
export default withAuthenticator(App, true);
Я хочу, чтобы результаты из Storage.get могли отображаться для воспроизведения видео