SamirHodzic / ngx-embed-video

Get embed code for embedding youtube/vimeo/dailymotion/* video in websites from URL or ID in Angular 6+.
MIT License
56 stars 41 forks source link

embedding video with special character #32

Open abdelrahman84 opened 5 years ago

abdelrahman84 commented 5 years ago

Hello,

For youtube input video, if the video has special character like below:

https://www.youtube.com/watch?v=I5tMPyP6D5o&feature=youtu.be.

Youtube will embed as below:

"https://www.youtube.com/embed/I5tMPyP6D5o

However, using your library, the embedded video is https://www.youtube.com/embed/I5tMPyP6D5o&feature

which is not opening.

So, actual output, should ignore any text after the special character.

To fix this in my local dev, I added a helper function to detect such string:

santize(video) {

if (video.indexOf('&') !== -1){
  var spliitedVideo = video.split('&')
  video = spliitedVideo[0]
  return video
}

}

Just thought of informing you. Still able to use the library with this function.

Thanks,