{"id":4664,"url":"https://github.com/xeodou/react-native-player","last_synced_at":"2025-06-21T05:35:21.499Z","repository":{"id":57339156,"uuid":"44981715","full_name":"xeodou/react-native-player","owner":"xeodou","description":"Media player for React Native","archived":false,"fork":false,"pushed_at":"2016-10-20T07:03:35.000Z","size":66,"stargazers_count":84,"open_issues_count":4,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-09T08:08:57.455Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xeodou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-26T16:28:17.000Z","updated_at":"2024-11-02T04:44:02.000Z","dependencies_parsed_at":"2022-08-28T10:00:34.112Z","dependency_job_id":null,"html_url":"https://github.com/xeodou/react-native-player","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xeodou/react-native-player","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeodou%2Freact-native-player","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeodou%2Freact-native-player/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeodou%2Freact-native-player/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeodou%2Freact-native-player/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xeodou","download_url":"https://codeload.github.com/xeodou/react-native-player/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeodou%2Freact-native-player/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261070059,"owners_count":23105320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:17:19.536Z","updated_at":"2025-06-21T05:35:16.489Z","avatar_url":"https://github.com/xeodou.png","language":"Java","readme":"### React-Native-Player\n\n\u003e Media Player for React-Native\n\n*Only Android support now.*\n\n#### Integrate\n\n##### Android\n\n* Install via npm\n`npm i react-native-player --save-dev`\n\n* Add dependency to `android/settings.gradle`\n```\n...\ninclude ':react-native-player'\nproject(':react-native-player').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-player/android/player')\n```\n\n* Add `android/app/build.gradle`\n```\n...\ndependencies {\n    ...\n    compile project(':react-native-player')\n}\n```\n* Register module in `MainActivity.java`\n```\nimport com.xeodou.rctplayer.*;  // \u003c--- import\n\n@Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        mReactRootView = new ReactRootView(this);\n\n        mReactInstanceManager = ReactInstanceManager.builder()\n                .setApplication(getApplication())\n                .setBundleAssetName(\"index.android.bundle\")\n                .setJSMainModuleName(\"index.android\")\n                .addPackage(new ReactPlayerManager())  // \u003c------- here\n                .addPackage(new MainReactPackage())\n                .setUseDeveloperSupport(BuildConfig.DEBUG)\n                .setInitialLifecycleState(LifecycleState.RESUMED)\n                .build();\n\n        mReactRootView.startReactApplication(mReactInstanceManager, \"doubanbook\", null);\n\n        setContentView(mReactRootView);\n    }\n```\n\n#### Usage\n```\nvar RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');\nvar Subscribable = require('Subscribable');\nvar RCTAudio = require('react-native-player');\n\n\nvar doubanbook = React.createClass({\n\n  mixins: [Subscribable.Mixin],\n\n  componentWillMount: function() {\n      this.addListenerOn(RCTDeviceEventEmitter,\n                       'error',\n                       this.onError);\n      this.addListenerOn(RCTDeviceEventEmitter,\n                       'end',\n                       this.onEnd);\n      this.addListenerOn(RCTDeviceEventEmitter,\n                       'ready',\n                       this.onReady);\n  },\n\n  componentDidMount: function() {\n\n  },\n\n  onError: function(err) {\n    console.log(err)\n  },\n\n  onEnd: function() {\n    console.log(\"end\")\n  },\n\n  onReady: function() {\n    console.log(\"onReady\")\n  },\n\n  start: function() {\n    RCTAudio.start()\n  },\n\n  pause: function() {\n    RCTAudio.pause()\n  },\n\n  stop: function() {\n    RCTAudio.stop()\n  },\n\n  buttonClicked: function() {\n    RCTAudio.prepare(\"https://api.soundcloud.com/tracks/223379813/stream?client_id=f4323c6f7c0cd73d2d786a2b1cdae80c\", true)\n  },\n\n  render: function() {\n    return (\n      \u003cView style={styles.container}\u003e\n        \u003cTouchableHighlight\n          style={styles.button}\n          onPress={this.buttonClicked}\u003e\n            \u003cText \u003ePrepare!\u003c/Text\u003e\n        \u003c/TouchableHighlight\u003e\n\n        \u003cTouchableHighlight\n          style={styles.button}\n          onPress={this.pause}\u003e\n            \u003cText \u003ePause!\u003c/Text\u003e\n        \u003c/TouchableHighlight\u003e\n\n         \u003cTouchableHighlight\n          style={styles.button}\n          onPress={this.start}\u003e\n            \u003cText \u003eStart!\u003c/Text\u003e\n        \u003c/TouchableHighlight\u003e\n\n      \u003c/View\u003e\n    );\n  }\n})\n\n```\n\n#### LICENSE\nMIT\n","funding_links":[],"categories":["Components"],"sub_categories":["Media"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxeodou%2Freact-native-player","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxeodou%2Freact-native-player","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxeodou%2Freact-native-player/lists"}