1

如何在本机播放中打开视频?!像动漫,流媒体应用程序等...

它不起作用

Linking.openURL('video:http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4');  }
4

1 回答 1

0

它适用于 Android 试试这个

import React from 'react';
import {NativeModules, Button} from 'react-native';

const App = () => {
  const SendIntentAndroid = NativeModules?.SendIntentAndroid || {};

  const onPress = () => {
    SendIntentAndroid?.openAppWithData(
       null,                                        // Package name
      'https://www.w3schools.com/html/mov_bbb.mp4', // uri
      'video/*',                                    // mime/type
      {},                                           // extras
    );
  };
  return <Button onPress={onPress} title={'Open video playback'} />;
};

export default App;

如果不起作用,请尝试安装

yarn add react-native-send-intent
npm install react-native-send-intent

环境:

  • 反应原生:“0.64.2” - CLI
  • 安卓设备
  • 视窗 10
于 2021-12-15T10:11:27.367 回答