react-player icon indicating copy to clipboard operation
react-player copied to clipboard

Query Regarding the URLs passed

Open papuruth opened this issue 4 years ago • 1 comments

Current Behavior

When passing URL to the player for some provider it is accepting both links normal as well as an embedded link. But for provider like Wistia, DailyMotion, SoundsCloud, and MixCloud only normal URL works.

URLS Example

// testLinkA is a normal URL
// testLinkB is an embedded URL

const URLS = {
  wistia: {
    testLinkA: "https://simmirocks880.wistia.com/medias/x8ou8gjgoq",
    testLinkB:
      "https://simmirocks880.wistia.com/medias/x8ou8gjgoq?embedType=iframe&videoFoam=true&videoWidth=640"
  },
  mixCloud: {
    testLinkA:
      "https://www.mixcloud.com/TheBlessedMadonna/we-still-believe-episode-090-it-couldnt-happen-here/",
    testLinkB:
      "https://www.mixcloud.com/widget/iframe/?hide_cover=1&feed=%2FTheBlessedMadonna%2Fwe-still-believe-episode-090-it-couldnt-happen-here%2F"
  },
  dailyMotion: {
    testLinkA: "https://www.dailymotion.com/video/x392c7l",
    testLinkB: "https://www.dailymotion.com/embed/video/x392c7l?autoplay=1"
  },
  soundCloud: {
    testLinkA:
      "https://soundcloud.com/hahahahahahahahahaha09/churi-khan-bhaini",
    testLinkB:
      "https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/1131912316"
  }
};

Expected Behavior

I want that the player loads only the normal URLs or only the embedded URLs or if it could load both for all providers then that would be great. I don't know how to make this happen a direction towards help would be appreciated.

Steps to Reproduce

  1. Open the Sandbox link attached below
  2. Wait for the page to load
  3. Click on the button present on the UI to load the URLs into the player and observe the result
  4. All the URLs linked to Test Link A works fine but fails for Test Link B

Environment

  • URL attempting to play: Attached above
  • Browser: Chrome
  • Operating Ubuntu:
  • Code SandBox example: https://codesandbox.io/s/busy-surf-dlc2o?file=/src/App.js

Other Information

If I'm passing the embedded links directly to an Iframe element it works smoothly.

papuruth avatar Oct 06 '21 10:10 papuruth

The URL matching patterns have been put together over time mostly based on trial and error and PRs to correct them.

I will gladly look at a PR updating the patterns to support more variations, but note that some of them have a capture group used to extract the video ID from the URL.

cookpete avatar Oct 26 '21 12:10 cookpete