Giter VIP home page Giter VIP logo

cookpete / react-player Goto Github PK

View Code? Open in Web Editor NEW
9.1K 78.0 1.1K 8.72 MB

A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion

Home Page: https://cookpete.github.io/react-player

License: MIT License

JavaScript 100.00%
react media player video audio youtube facebook twitch soundcloud streamable

react-player's Introduction

ReactPlayer

Latest npm version Test Coverage Become a sponsor on Patreon

A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia, Mixcloud, DailyMotion and Kaltura. Not using React? No problem.


Using Next.js and need to handle video upload/processing? Check out next-video.

✨ The future of ReactPlayer

Maintenance of ReactPlayer is being taken over by Mux. The team at Mux have worked on many highly respected projects and are committed to improving video tooling for developers.

ReactPlayer will remain open source, but with a higher rate of fixes and releases over time. Thanks to everyone in the community for your ongoing support.

Usage

npm install react-player # or yarn add react-player
import React from 'react'
import ReactPlayer from 'react-player'

// Render a YouTube video player
<ReactPlayer url='https://www.youtube.com/watch?v=LXb3EKWsInQ' />

By default, ReactPlayer supports many different types of url. If you only ever use one type, use imports such as react-player/youtube to reduce your bundle size. See config keys for all player keys.

import React from 'react'
import ReactPlayer from 'react-player/youtube'

// Only loads the YouTube player
<ReactPlayer url='https://www.youtube.com/watch?v=LXb3EKWsInQ' />

If your build system supports import() statements, use react-player/lazy to lazy load the appropriate player for the url you pass in. This adds several reactPlayer chunks to your output, but reduces your main bundle size.

import React from 'react'
import ReactPlayer from 'react-player/lazy'

// Lazy load the YouTube player
<ReactPlayer url='https://www.youtube.com/watch?v=ysz5S6PUM-U' />

Demo page: https://cookpete.github.io/react-player

The component parses a URL and loads in the appropriate markup and external SDKs to play media from various sources. Props can be passed in to control playback and react to events such as buffering or media ending. See the demo source for a full example.

For platforms without direct use of npm modules, a minified version of ReactPlayer is located in dist after installing. To generate this file yourself, checkout the repo and run npm run build:dist.

Autoplay

As of Chrome 66, videos must be muted in order to play automatically. Some players, like Facebook, cannot be unmuted until the user interacts with the video, so you may want to enable controls to allow users to unmute videos themselves. Please set muted={true}.

Props

Prop Description Default
url The url of a video or song to play
  ◦  Can be an array or MediaStream object
playing Set to true or false to pause or play the media false
loop Set to true or false to loop the media false
controls Set to true or false to display native player controls.
  ◦  For Vimeo videos, hiding controls must be enabled by the video owner.
false
light Set to true to show just the video thumbnail, which loads the full player on click
  ◦  Pass in an image URL to override the preview image
false
volume Set the volume of the player, between 0 and 1
  ◦  null uses default volume on all players #357
null
muted Mutes the player
  ◦  Only works if volume is set
false
playbackRate Set the playback rate of the player
  ◦  Only supported by YouTube, Wistia, and file paths
1
width Set the width of the player 640px
height Set the height of the player 360px
style Add inline styles to the root element {}
progressInterval The time between onProgress callbacks, in milliseconds 1000
playsinline Applies the playsinline attribute where supported false
pip Set to true or false to enable or disable picture-in-picture mode
  ◦  Only available when playing file URLs in certain browsers
false
stopOnUnmount If you are using pip you may want to use stopOnUnmount={false} to continue playing in picture-in-picture mode even after ReactPlayer unmounts true
fallback Element or component to use as a fallback if you are using lazy loading null
wrapper Element or component to use as the container element div
playIcon Element or component to use as the play icon in light mode
previewTabIndex Set the tab index to be used on light mode 0
config Override options for the various players, see config prop

Callback props

Callback props take a function that gets fired on various player events:

Prop Description
onReady Called when media is loaded and ready to play. If playing is set to true, media will play immediately
onStart Called when media starts playing
onPlay Called when media starts or resumes playing after pausing or buffering
onProgress Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds
  ◦  eg { played: 0.12, playedSeconds: 11.3, loaded: 0.34, loadedSeconds: 16.7 }
onDuration Callback containing duration of the media, in seconds
onPause Called when media is paused
onBuffer Called when media starts buffering
onBufferEnd Called when media has finished buffering
  ◦  Works for files, YouTube and Facebook
onSeek Called when media seeks with seconds parameter
onPlaybackRateChange Called when playback rate of the player changed
  ◦  Only supported by YouTube, Vimeo (if enabled), Wistia, and file paths
onPlaybackQualityChange Called when playback quality of the player changed
  ◦  Only supported by YouTube (if enabled)
onEnded Called when media finishes playing
  ◦  Does not fire when loop is set to true
onError Called when an error occurs whilst attempting to play media
onClickPreview Called when user clicks the light mode preview
onEnablePIP Called when picture-in-picture mode is enabled
onDisablePIP Called when picture-in-picture mode is disabled

Config prop

There is a single config prop to override settings for each type of player:

<ReactPlayer
  url={url}
  config={{
    youtube: {
      playerVars: { showinfo: 1 }
    },
    facebook: {
      appId: '12345'
    }
  }}
/>

Settings for each player live under different keys:

Key Options
youtube playerVars: Override the default player vars
embedOptions: Override the default embed options
onUnstarted: Called when state changes to unstarted (usually when video fails to autoplay)
facebook appId: Your own Facebook app ID
version: Facebook SDK version
playerId: Override player ID for consistent server-side rendering (use with react-uid)
attributes: Extra data attributes to pass to the fb-video element
soundcloud options: Override the default player options
vimeo playerOptions: Override the default params
title: Set the player iframe title attribute
mux attributes: Apply element attributes
version: Mux player version
wistia options: Override the default player options
playerId: Override player ID for consistent server-side rendering (use with react-uid)
mixcloud options: Override the default player options
dailymotion params: Override the default player vars
twitch options: Override the default player options
playerId: Override player ID for consistent server-side rendering (use with react-uid)
file attributes: Apply element attributes
forceVideo: Always render a <video> element
forceAudio: Always render an <audio> element
forceHLS: Use hls.js for HLS streams
forceSafariHLS: Use hls.js for HLS streams, even on Safari
forceDisableHLS: Disable usage hls.js for HLS streams
forceDASH: Always use dash.js for DASH streams
forceFLV: Always use flv.js
hlsOptions: Override the default hls.js options
hlsVersion: Override the hls.js version loaded from jsdelivr, default: 0.13.1
dashVersion: Override the dash.js version loaded from cdnjs, default: 2.9.2
flvVersion: Override the flv.js version loaded from jsdelivr, default: 1.5.0

Methods

Static Methods

Method Description
ReactPlayer.canPlay(url) Determine if a URL can be played. This does not detect media that is unplayable due to privacy settings, streaming permissions, etc. In that case, the onError prop will be invoked after attempting to play. Any URL that does not match any patterns will fall back to a native HTML5 media player.
ReactPlayer.canEnablePiP(url) Determine if a URL can be played in picture-in-picture mode
ReactPlayer.addCustomPlayer(CustomPlayer) Add a custom player. See Adding custom players
ReactPlayer.removeCustomPlayers() Remove any players that have been added using addCustomPlayer()

Instance Methods

Use ref to call instance methods on the player. See the demo app for an example of this.

Method Description
seekTo(amount, type) Seek to the given number of seconds, or fraction if amount is between 0 and 1
  ◦  type parameter lets you specify 'seconds' or 'fraction' to override default behaviour
getCurrentTime() Returns the number of seconds that have been played
  ◦  Returns null if unavailable
getSecondsLoaded() Returns the number of seconds that have been loaded
  ◦  Returns null if unavailable or unsupported
getDuration() Returns the duration (in seconds) of the currently playing media
  ◦  Returns null if duration is unavailable
getInternalPlayer() Returns the internal player of whatever is currently playing
  ◦  eg the YouTube player instance, or the <video> element when playing a video file
  ◦  Use getInternalPlayer('hls') to get the hls.js player
  ◦  Use getInternalPlayer('dash') to get the dash.js player
  ◦  Returns null if the internal player is unavailable
showPreview() When using light mode, returns to the preview overlay

Advanced Usage

Light player

The light prop will render a video thumbnail with simple play icon, and only load the full player once a user has interacted with the image. Noembed is used to fetch thumbnails for a video URL. Note that automatic thumbnail fetching for Facebook, Wistia, Mixcloud and file URLs are not supported, and ongoing support for other URLs is not guaranteed.

If you want to pass in your own thumbnail to use, set light to the image URL rather than true.

You can also pass a component through the light prop:

<ReactPlayer light={<img src='https://example.com/thumbnail.png' alt='Thumbnail' />} />

The styles for the preview image and play icon can be overridden by targeting the CSS classes react-player__preview, react-player__shadow and react-player__play-icon.

Responsive player

Set width and height to 100% and wrap the player in a fixed aspect ratio box to get a responsive player:

class ResponsivePlayer extends Component {
  render () {
    return (
      <div className='player-wrapper'>
        <ReactPlayer
          className='react-player'
          url='https://www.youtube.com/watch?v=ysz5S6PUM-U'
          width='100%'
          height='100%'
        />
      </div>
    )
  }
}
.player-wrapper {
  position: relative;
  padding-top: 56.25%; /* Player ratio: 100 / (1280 / 720) */
}

.react-player {
  position: absolute;
  top: 0;
  left: 0;
}

See jsFiddle example

SDK Overrides

You can use your own version of any player SDK, assuming the correct window global is set before the player mounts. For example, to use a local version of hls.js, add <script src='/path/hls.js'></script> to your app. If window.Hls is available when ReactPlayer mounts, it will use that instead of loading hls.js from cdnjs. See #605 for more information.

Standalone player

If you aren’t using React, you can still render a player using the standalone library:

<script src='https://cdn.jsdelivr.net/npm/react-player/dist/ReactPlayer.standalone.js'></script>
<script>
  const container = document.getElementById('container')
  const url = 'https://www.youtube.com/watch?v=d46Azg3Pm4c'

  renderReactPlayer(container, { url, playing: true })

  function pausePlayer () {
    renderReactPlayer(container, { url, playing: false })
  }
</script>

See jsFiddle example

Adding custom players

If you have your own player that is compatible with ReactPlayer’s internal architecture, you can add it using addCustomPlayer:

import YourOwnPlayer from './somewhere';
ReactPlayer.addCustomPlayer(YourOwnPlayer);

Use removeCustomPlayers to clear all custom players:

ReactPlayer.removeCustomPlayers();

It is your responsibility to ensure that custom players keep up with any internal changes to ReactPlayer in later versions.

Mobile considerations

Due to various restrictions, ReactPlayer is not guaranteed to function properly on mobile devices. The YouTube player documentation, for example, explains that certain mobile browsers require user interaction before playing:

The HTML5 <video> element, in certain mobile browsers (such as Chrome and Safari), only allows playback to take place if it’s initiated by a user interaction (such as tapping on the player).

Multiple Sources and Tracks

Passing an array of YouTube URLs to the url prop will load them as an untitled playlist.

<ReactPlayer
  url={[
    'https://www.youtube.com/watch?v=oUFJJNQGwhk',
    'https://www.youtube.com/watch?v=jNgP6d9HraI'
  ]}
/>

When playing file paths, an array of sources can be passed to the url prop to render multiple <source> tags.

<ReactPlayer playing url={['foo.webm', 'foo.ogg']} />

You can also specify a type for each source by using objects with src and type properties.

<ReactPlayer
  playing
  url={[
    {src: 'foo.webm', type: 'video/webm'},
    {src: 'foo.ogg', type: 'video/ogg'}
  ]}
/>

<track> elements for subtitles can be added using config.file:

<ReactPlayer
  playing
  url='foo.webm'
  config={{ file: {
    tracks: [
      {kind: 'subtitles', src: 'subs/subtitles.en.vtt', srcLang: 'en', default: true},
      {kind: 'subtitles', src: 'subs/subtitles.ja.vtt', srcLang: 'ja'},
      {kind: 'subtitles', src: 'subs/subtitles.de.vtt', srcLang: 'de'}
    ]
  }}}
/>

Migrating to v2.0

ReactPlayer v2.0 changes single player imports and adds lazy loading players. Support for preload has also been removed, plus some other changes. See MIGRATING.md for information.

Supported media

Contributing

See the contribution guidelines before creating a pull request.

Thanks


Jackson Doherty

Joseph Fung

react-player's People

Contributors

ablackoff avatar afzaalahmad avatar arnas avatar arnemolland avatar awkk avatar bastei avatar belgattitude avatar berdyshev avatar billdybas avatar borozcod avatar cookpete avatar dednal avatar edunad avatar fauntleroy avatar github-actions[bot] avatar idiglove avatar kevinzwhuang avatar komachi avatar luwes avatar me-andre avatar meenie avatar nikolas avatar ptgamr avatar quicksnap avatar skinymonkey avatar sky161 avatar tarhan avatar the4dpatrick avatar xouabita avatar yasamato avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-player's Issues

Help a rookie

Hi Pete
I'm soooo interested in react-player, but I'm not an experienced programmer so I'm having some issues with npm, node.js and so on.

I've read that for platforms that don't support npm, the minified ReactPlayer.js will do the trick. Unfortunatly it seems that reactplayer.js has a dependency on React.

What Im trying to reach is just something like

root
-- ReactPlayer.js
-- ReactPlayer.js.map
-- index.html

where index.html is something like

<html>
<head>
<script src='ReactPlayer.js'></script>
</head>
<body>

    <script>
    ReactDOM.render(
      "<ReactPlayer url='https://www.youtube.com/watch?v=d46Azg3Pm4c' playing />",
      document.getElementById('container')
    );

  </script>

    <div id="container"></div>
</body>
</html>

which of course doesn't work....

Be kind, help a rookie!
Thank you

Francesco

Volume only gets set after players are loaded

If you set the volume of ReactPlayer when you instantiate it, (at least) the YouTube and SoundCloud players will not respect it (and seem to use 0.8). I imagine this is because setVolume calls are currently stopped instead of queued when the player isn't ready yet.

YouTube player will not autoplay if window is not focused

When you use a page with react-player in it, YouTube videos will not autoplay when the window does not have focus. While I'm certain YouTube has good intentions here, my application requires YouTube videos to play automatically regardless of whether the window is focused or not. Here are a few things I've tried but don't seem to work:

  • Run .playVideo() after the onReady event of the YouTube player fires
  • Constantly run window.focus() in the hope that they have a listener there (nope)

react-player attempts to call `this.player.getDuration()` before method is available

If you tell the YouTube player to seek before the SDK has finished loading, react-player will attempt to call getDuration() and throw. I haven't checked into this with the other players yet.

Should be a simple fix: add a flag for whether or not the SDK has loaded yet. If the flag is false, don't try to call any methods provided by that SDK. Might also want to wrap the SDK methods with something normalized that does that check before calling the real method.

(Sorry about making issues with recommendations but not pull reqs—it's a bit difficult to get the full flow going while on holiday)

onError called without error message

I use the player similar to the demo App, including onError={(e) => console.log('onError', e)}.

onError is called each time the player is loaded, but the song plays just fine. The e is undefined.

Sometimes an mp3 URL can not be loaded from a remote source and the same error with an undefined error message is triggered.

Any idea how I can dig deeper into this to see what is going on?

YouTube occasionally fires onDuration with 0

I think onDuration is called too early for YouTube, as I'm occasionally seeing 0 returned. I might have been trying to be too clever by firing it in onReady and assuming that duration was available then.

Upgrade to react 15

Hi, Would be nice if the react-player will also require 15.0.1 (at the time of writing) and not depend only on 0.14.
Thanks!

Proper error codes

Further to #44, there is a need for more robust onError return values to align the different problems that can occur with the different players.

SoundCloud player doesn't get destroyed if you're quick like a QA engineer

If you switch to another media URL before the SoundCloud SDK loads an initializes, the SoundCloud player will stay alive... forever. I imagine this is because this.stop() does nothing when this.player doesn't exist yet.

To replicate:

  • npm run start
  • Go to http://localhost:3000/
  • Very quickly click "Soundcloud song" then "Vimeo video"
  • The Soundcloud song will continue playing while the Vimeo video plays

This should never happen in the wild, so I don't think it's a high priority at this time.

onProgress no longer called after seeking

This is with the YT HTML5 player in Firefox, with the controls turned on in the YT options.

I have a simple onProgress that logs the progress at 100ms intervals. After seeking using YT's own timeline onProgress is never called again (even after pausing/replaying the video). I haven't debugged extensively but I get the impression that maybe the setTimeout stops being called.

The information is there. I'm working around this in my parent component by polling this.refs.player.refs.player.player.getCurrentTime() (sic) and that keeps on working.

onProgress is inconsistent when tab is not focused (Chrome)

In Chrome the onProgress event fires irregularly, I assume due to some of Chrome's more... interesting behaviors related to setTimeout and setInterval in inactive tabs.

I'm going to try and resolve this issue myself at some point this week, but I'd love to know if you have any ideas. Obviously, relying on the events that the providers' players emit would be ideal, but I'm pretty certain at least one of them doesn't emit the event we need.

Get the time remaining on a video/audio

Hi @cookpete maybe I'm just missing it, but I can't find a way to check how much time is still left on a song or the total length of the clip? Is that because there is no way to do it yet or did I just over look it?

onDuration returns null for HTML5 player

onDuration will return null if you programmatically set playing={true} immediately after the component mounts. The video will still play. This problem doesn't exist for youtube sources.

I assume this is because onDuration is being called before the video has fully loaded because putting playVideo() in a timeOut will fix the problem.

Multiple youtube player

Hi @cookpete , first I wanted to thank you for the excellent component, he's helping me a lot. I was wondering if you have plans to add a possibility to create multiple youtube player. I am trying to add, but i am not succeeding :(

Thanks!

Deprecation warnings around `findDOMNode`

Running with React 0.14.0-beta3, I receive the following when loading the player...this one comes from the Vimeo player (see traceback):

Warning: `require("react").findDOMNode` is deprecated. Please use `require("react-dom").findDOMNode` instead.
warning @   warning.js:45
legacyGetDOMNode    @   ReactDOMComponent.js:90
componentDidMount   @   Vimeo.js:74
module.exports.proto.(anonymous function)   @   makeAssimilatePrototype.js:15
assign.notifyAll    @   CallbackQueue.js:65
ON_DOM_READY_QUEUEING.close @   ReactReconcileTransaction.js:80
Mixin.closeAll  @   Transaction.js:202
Mixin.perform   @   Transaction.js:149
Mixin.perform   @   Transaction.js:136
assign.perform  @   ReactUpdates.js:86
flushBatchedUpdates @   ReactUpdates.js:147
ReactPerf.measure.wrapper   @   ReactPerf.js:66
Mixin.closeAll  @   Transaction.js:202
Mixin.perform   @   Transaction.js:149
ReactDefaultBatchingStrategy.batchedUpdates @   ReactDefaultBatchingStrategy.js:62
batchedUpdates  @   ReactUpdates.js:94
ReactEventListener.dispatchEvent    @   ReactEventListener.js:197

suggestion: onStart handler

onStart handler that runs only once at the beginning of video playing (and no other time, unless video ID changes).

It's a pretty simple handler so I'm sure there's many uses, but my specific use cases are:

  • an UI effect that fades in the player as a video begins playing.
  • fade in the volume gradually as the video begins playing.

The handler can technically be emulated with onPlay and setState, but it's rather verbose for a relatively fundamental act.

autoplay after onEnd

I'm trying to play the next song when one is finished.

I've added this to the onEnded prop but it only triggers when tab gain focus again.
The component is not created again, the iframe is not recreated.

This should work since the latest updates right ?
I'm only trying on localhost (just stating in case chrome is allowing iframe on specific domain)

Module not found: Error: SoundCloud.js

Can't get it to work after installing via NPM

All I have in my component at this point is the following

'use strict';

import React from 'react';
import ReactPlayer from 'react-player'

The console ouput

client?3f25:47 ./~/react-player/lib/players/SoundCloud.js
Module not found: Error: Cannot resolve module 'exports' in C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\lib\players
resolve module exports in C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\lib\players
  looking for modules in C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules
    module variation exports-webpack-loader
      C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-webpack-loader doesn't exist (module as directory)
      resolve 'file' exports-webpack-loader in C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules
        resolve file
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-webpack-loader doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-webpack-loader.webpack-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-webpack-loader.web-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-webpack-loader.loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-webpack-loader.js doesn't exist
    module variation exports-web-loader
      C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-web-loader doesn't exist (module as directory)
      resolve 'file' exports-web-loader in C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules
        resolve file
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-web-loader doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-web-loader.webpack-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-web-loader.web-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-web-loader.loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-web-loader.js doesn't exist
    module variation exports-loader
      C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-loader doesn't exist (module as directory)
      resolve 'file' exports-loader in C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules
        resolve file
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-loader doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-loader.webpack-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-loader.web-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-loader.loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-loader.js doesn't exist
    module variation exports
      C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports doesn't exist (module as directory)
      resolve 'file' exports in C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules
        resolve file
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports.webpack-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports.web-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports.loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports.js doesn't exist
  looking for modules in C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules
    module variation exports-webpack-loader
      C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-webpack-loader doesn't exist (module as directory)
      resolve 'file' exports-webpack-loader in C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules
        resolve file
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-webpack-loader doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-webpack-loader.webpack-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-webpack-loader.web-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-webpack-loader.loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-webpack-loader.js doesn't exist
    module variation exports-web-loader
      C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-web-loader doesn't exist (module as directory)
      resolve 'file' exports-web-loader in C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules
        resolve file
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-web-loader doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-web-loader.webpack-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-web-loader.web-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-web-loader.loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-web-loader.js doesn't exist
    module variation exports-loader
      C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-loader doesn't exist (module as directory)
      resolve 'file' exports-loader in C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules
        resolve file
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-loader doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-loader.webpack-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-loader.web-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-loader.loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-loader.js doesn't exist
    module variation exports
      C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports doesn't exist (module as directory)
      resolve 'file' exports in C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules
        resolve file
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports.webpack-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports.web-loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports.loader.js doesn't exist
          C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports.js doesn't exist
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-webpack-loader]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-webpack-loader]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-webpack-loader.webpack-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-webpack-loader.web-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-webpack-loader.loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-webpack-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-web-loader]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-web-loader]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-web-loader.webpack-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-web-loader.web-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-web-loader.loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-web-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-loader]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-loader]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-loader.webpack-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-loader.web-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-loader.loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports.webpack-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports.web-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports.loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\react-player\node_modules\exports.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-webpack-loader]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-webpack-loader]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-webpack-loader.webpack-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-webpack-loader.web-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-webpack-loader.loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-webpack-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-web-loader]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-web-loader]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-web-loader.webpack-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-web-loader.web-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-web-loader.loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-web-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-loader]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-loader]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-loader.webpack-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-loader.web-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-loader.loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports.webpack-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports.web-loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports.loader.js]
[C:\Users\gablabelle\Sites\darik\Cloudversify.Darik\Cloudversify.Darik.Web\node_modules\exports.js]
 @ ./~/react-player/lib/players/SoundCloud.js 1:0-65

Methods

If I don't want to use react, how can I access to ReactPlayer methods"traditionally"?

I need something like:

ReactPlayer.load(url)
ReactPlayer.stop()
ReactPlayer.play()
ReactPlayer.volume(volumeLevel)
ReactPlayer.seekTo(position)

Thank you!

YouTube player occasionally does not preload properly

I'm still trying to get to the bottom of this one, but I have a theory for why it might not work properly 100% of the time:

  • Player starts with a valid SoundCloud URL
  • SoundCloud player is rendered before the YouTube iframe is rendered and ready
  • YouTube iframe does not have whatever focus token Chrome gives it
  • This tab/window loses focus
  • YouTube videos will not autoplay until window attains focus

YouTube videos won't play in IE

IE complains about missing Promise.

I fixed it in a local install (because my deadline is in a few minutes) by installing [https://github.com/stefanpenner/es6-promise] and importing in the YouTube player. That fixed it for both IE 10 and 11.

I'd be happy to make a pull request, if you'd like.

Can't use FilePlayer

Hello,

Maybe it's me but, I can't implement the File Player, I got the following error message:

screenshot 2016-01-25 02 24 38

Do you have any idea?

When onEnded triggers, I would also like to exit fullscreen, but no method exists.

I currently have a "bug" when a video plays to it's completion and the user also has the player in full screen mode. It seems that I should force the player to exit full screen before changing the state of my React app. The containing div does not seem to revert to it's state before it was in full screen, and wreaks the layout. Is this a quirk of the Vimeo embed? Or do I not have hardy enough CSS? Please advise. You can visit an example at: http://www.bobbylam.com and playing a video, entering full screen, and skipping to the end to see the unintended behavior.

Video will autoplay even when props.playing is false

Changing the url prop currently autoplays the song you want to load, even if props.playing is false. Autoplay should be disabled and then play called when player is ready only if playing is true.

Or.. set autoplay to the same value as props.playing?

When minified, only one player component is mounted

I'm having a bit of an odd issue here:

When I use react-player in my project, then minify the project bundle, only one of the players will mount (the YouTube player). I have a hunch that displayName is somehow involved (since all react-player components are shown as t in the React DevTools).

screen shot 2015-12-27 at 9 05 25 am

#### Steps to replicate - Create a project that uses browserify - Use `react-player` in that project - Browserify your code - Minify your code - When the player is mounted, you should only see one player type mounted inside of it #### Ideas - Try minifying `react-player` in the test page and see if we can replicate the issue there - Try manually setting `displayName` for every component

Mobile-friendly?

On mobile, the ReactPlayer just buffers and buffers and buffers and will not play YouTube videos. Is this a function of mobile or of the youtube api?

Media player controls

Hi @cookpete! I noticed in the example that the file players didn't have any standard controls. Is there a config option to show or hide them? If not, what is the best way you recommend to have player controls show up?

Thanks for this library!

Safari requests http instead of https://www.youtube.com/iframe_api

On safari, the youtube API will request the non-SSL version. This bug doesn't appear on firefox or chrome.

The result is the following error:

[Error] Unable to post message to http://www.youtube.com. Recipient has origin https://www.youtube.com.

    postMessage
    K (www-widgetapi.js:98:345)
    O (www-widgetapi.js:95)
    (anonymous function)

I managed to hack together a fix by forcing the https version by prepending "https:" to SDK_URL on line 35 of lib/players/YouTube.js.

Strangely, I can't seem to replicate this on the demo.

Make PROGRESS_FREQUENCY a prop

I think it would be better to make PROGRESS_FREQUENCY a prop that the user can set. 1000ms is a bit too long and could look very janky on some styles of seeking track and nub.

Unreliable karma tests in Travis

It seems like the browser inside the Travis CI machines isn't quite good enough to safely test in Travis. See an example build log where one test fails, which I can't reproduce locally. Perhaps in Travis we should revert to just the shallow render tests, and just run karma tests locally when building/releasing.

Fullscreen options

After seeing @scpaye506's fork that enables fullscreen on Vimeo, I wonder if we should enable fullscreen for Vimeo by default? It could still be overridden back to false via the vimeoConfig prop. If not, I would be inclined to disable fullscreen on YouTube, to align behaviour across players.

Even fullscreen for FilePlayer is possible, but would require controls to be enabled.

Perhaps there is a need for a top level allowFullScreen prop?

Bower support is broken

Following on from #38 (comment), the minified ReactPlayer.js file needs to be part of the git repo for it to be pulled down by bower install.

Perhaps it should be built and added during the version step, to save having to commit the file every time the source files change.

Support for posters?

Is there anyway to set the poster along with the url?

 url={url} poster={poster}

The player is working perfectly except that it often shows a black screen for mp4 videos and doesn't always show the max res for YouTube, so it would be great if we could optionally set the poster manually.

Error while running the demo

I executed all the commands as described in the README but the bundle.js won't be generated, the browser shows GET http://localhost:3000/static/bundle.js 404 (Not Found). I captured the output of npm start in this gist. Do you have any idea what I'm doing wrong?

Custom URL not loading the first time on mobile

Hey,

I've noticed some strange behaviour when trying to load a custom .mp3 on mobile. All the state behaviour obviously changes correctly, but the audio clip doesn't play(load) the first time. When I press pause and play again then it works.

I've spent a good 2 hours trying to trouble shoot the issue in my app when I decided to check if it does the same on your demo... And it does.

Do you have any ideas as to why this could happen? It works fine on desktop browsers, but does has this bug on iOS Safari and Chrome as well as Android Chrome.

Thanks.

MP4 file autoplays when playing props is set to false

Hi,
Thanks for the player, it looks promising.

There's an issue with mp4 files, they autoplay even if playing={false} is passed as a prop.

It's related with the play() call in players/Base.js componentDidMount.
It seems required to init some players (Youtube, SoundCloud...) since they're initialized in the play method. Maybe moving the initalization part in a separate method, and calling this in componentDidMount could avoid this issue.

Meteor + React

Hey Pete,

This is a truly awesome project. Wow!

I would like to integrate this into my Meteor/React web application, and I think that it needs to be able to work with Browserify. Any suggestions on how I can make this work?

Best,
Nathan

minified / concatenated js

Hi, I'm trying to build a minified version of react player so I can use it from clojurescript.

I'm not familiar with buildpack so I'm not sure how I should do it from the sources.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.