Open video with window.open and get src from html5 video player

0

I have a URL of a video (it's not from youtube) that I want to run from window.open , when it is executed the video player HTML5 of the browser is automatically loaded. The URL that I have when read by the browser changes, it is not the same.

My dilemma, is that I need to get the URL of the window (window.open) or the SRC of the player that runs in said window, "I do not need to modify or remove", only get the attribute "src" of the player loaded and get the URL , just that, just get the URL and store it in a variable or in some result shown as in .innerHTML or load a iframe with URL already processed and then the pop or window closes.

Url_del_video = link (change _ for. "point" and - for /)

Note: I would also use some other way to get the URL after being processed , I accept suggestions and / or proposals.

The code with which I have been trying uselessly is the following:

<!DOCTYPE html>
<html>
<body>
<script>
 var myWindow = window.open("Url_del_video", "", "width=400,height=200");

var x = myWindow.getElementsByTagName("video")[0].getAttribute("src");

document.getElementById("demo").innerHTML = myWindow.x;
document.getElementsByTagName('iframe')[0].setAttribute('src',x);
</script>
<p id="demo"></p>
<iframe></iframe>
</body>
</html>

Once again, waiting for a quick response and thank you very much.

    
asked by Manuel b 15.10.2017 в 23:06
source

1 answer

0

One option would be to use the Google API that does pass as a parameter the% co_of shortened% it will return the value of% full% Co (longUrl) or vice versa.

Making a call type URL (Jquery for simplicity)

<iframe id="mivideo"></iframe>

var url = "...";
$.get('https://www.googleapis.com/urlshortener/v1/url?',
     { shortUrl:  url , key : 'mikeygoogle'}, function(data) {
    $('#mivideo').attr('src', data.longUrl); // añadimos al iframe
});
  

In URL , you must add your GET provided by Google when activating the mikeygoogle KEY

    
answered by 16.10.2017 в 00:49