In my code I am trying to extract src value from JavaScript variable but I am literary confused because I have two src values JavaScript so I am using explode function but it doesn't extract the url properly. My main goal is to get only .mp4 url from it but I don't how to extract it. I have no problem to use regex because it simple and short but I don't know how to use for it.
Here is the my PHP Code
$b = "var myVideo=videojs('my_play');myVideo.src([{type:\"video/mp4\",src:\"https://example.com/dl/abc123/video.mp4\"}])";
$data = explode('type:"video/mp4",src:"', $b);
echo $data[1];
Echo show this value
https://example.com/dl/abc123/video.mp4"}])
Expected output:
https://example.com/dl/abc123/video.mp4