reactivehappy
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Error in Embedding Youtube video with custom coding for wp pageyes, that might be an issue. Also strangely, in the same page, if we are traversing to the next pagination by clicking on “NEXT” button, then there is no issue loading the thumbnails or, playing video. Same is happening, if we come back again to the first (1) pagination. All the videos are loading fine.
Thus I highly doubt, while loading for the first time, while setting up the Gallery, the video codes are getting stripped somewhere.
Forum: Fixing WordPress
In reply to: Error in Embedding Youtube video with custom coding for wp pageThanks @threadi for having a look into this. Indeed I had also doubted the same getVideoCode function in the app.js. But when I tested that functionality I am getting expected video id.
Just open this url : https://www.w3schools.com/php/phptryit.asp?filename=tryphp_intro And replace the whole code snippet with below isolated GetVideoCode function in the code window.
<!DOCTYPE html> <html> <head> <script> function extractVideoID(url) { var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; var match = url.match(regExp); if (match && match[7].length == 11) { return match[7]; } else { alert('Could not extract video ID.'); } } </script> </head> <body> <script> var x = extractVideoID('https://www.youtube.com/watch?v=Hyf3kWR-jg0&t=5s'); alert(x); </script> </body> </html>
This regExp filters expected result i:e; Hyf3kWR-jg0 from the Youtube url ‘https://www.youtube.com/watch?v=Hyf3kWR-jg0&t=5s‘ .
That’s why I am still struggling to get to the bottom of it on what exatly causing this issue?