How to share external video file?

I have tried to share external video file.
here is my codes.

onShare = (title) =>{
let shareOptions = {
message: this.state.question,
url: ‘data:video/mp4;base64,’+this.state.video_base64,
};
if(title==’facebook’ || title==’twitter’){
Share.shareSingle(Object.assign(shareOptions, {
“social”: title
})).then(result=>{
console.log(result);
})
.catch((error) =>{
console.log(error);
});
}
}

but I could not share.
Please help me.
thanks,

1 thought on “How to share external video file?

  1. If anyone comes across this in the future and is also using using react-native-fetch-blob. After experimenting I found adding the appendExt: fileType to your config obj, will allow you to share the file from the path.

    RNFetchBlob.config({
      fileCache : true,
      appendExt : 'mp4'
    }).fetch('GET', mediaEntry.itemURL, {})
    .then((res:any) => {
      let shareOptions = {
        title: "Check out my video",
        message: "Check out my video!",
        url: 'file://' + res.path(),
        type: 'video/mp4',
        subject: "Check out my video!"
      }
      share.open(shareOptions)
        .then((res:any) => console.log('res:', res))
        .catch((err:any) => console.log('err', err))
      });
    

Comments are closed.

How to share external video file?

I have tried to share external video file.
here is my codes.

onShare = (title) =>{
let shareOptions = {
message: this.state.question,
url: ‘data:video/mp4;base64,’+this.state.video_base64,
};
if(title==’facebook’ || title==’twitter’){
Share.shareSingle(Object.assign(shareOptions, {
“social”: title
})).then(result=>{
console.log(result);
})
.catch((error) =>{
console.log(error);
});
}
}

but I could not share.
Please help me.
thanks,

1 thought on “How to share external video file?

  1. If anyone comes across this in the future and is also using using react-native-fetch-blob. After experimenting I found adding the appendExt: fileType to your config obj, will allow you to share the file from the path.

    RNFetchBlob.config({
      fileCache : true,
      appendExt : 'mp4'
    }).fetch('GET', mediaEntry.itemURL, {})
    .then((res:any) => {
      let shareOptions = {
        title: "Check out my video",
        message: "Check out my video!",
        url: 'file://' + res.path(),
        type: 'video/mp4',
        subject: "Check out my video!"
      }
      share.open(shareOptions)
        .then((res:any) => console.log('res:', res))
        .catch((err:any) => console.log('err', err))
      });
    

Comments are closed.