Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Video source link grabbing by PHP

php problem video nginx

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1 Szmycu

Szmycu

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 08 January 2015 - 01:59 PM

Hello.

 

I have a problem with video source link.

On my website i have my own video player and i want to play movies in this player thats why I need video source link.

 

 

I have made script in PHP which retrieve video source url from html code. So I put http://www.cda.pl/vi...-Reakcja-dzieci this code and on field in my site then my script grabbed video source url http://vsbg012.cda.p...pg&e=1420688920 to database and everything were fine. Video was playing on my video player.

 

After 3 hours I wanted do display this same movie from my site and then information appeared ‘The requested video is not found’.To see what happened, I went to this link http://www.cda.pl/vi...-Reakcja-dzieci myself and checked html code on browser. It turned out that the video source url was changed! From this first above to this  http://vsbg012.cda.p...1w&e=1420752870 . If you put video source link to brower then appear ‘401 Forbidden nginx’. Before in this same link was playing video on player.

 

So thats mean they have some mechanism which generate links video source for every session or dynamically generate links with access token or it is part of some mechanism of server– I dont know.

 

1.  I want to know what is that mechanism and how it called?

2.  Is there possibilty to grab dynamically video source url to my site?

 

Its normal when I put video source url on my database its static and stored. But I was wondering about that, when someone click on my video to play then -> programming language will grab dynamically video source url from normal link like that http://www.cda.pl/vi...-Reakcja-dzieci and store it or database( ornot if not needed) -> video will play.

 

3.       What tools and programming language should I use to do that script please give me advice and tips.

 

 

Thanks for any help



#2 grisha

grisha

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 106 posts

Posted 08 January 2015 - 02:12 PM

I think you've already answered yourself.

 

What I would advice is to make at most two asynchronous calls here:

First one will try to load the movie (video url) if it fails, then you should have a second routine that will visit the source url once again to get the new video url.

Then the old value of the video url should be replaced in the database, and returned to the player so the movie can be finally loaded.

 

Everything must be preformed without users notice.

 

So that's PHP / JS / AJAX.

 

Did you implement the player yourself (Action Script?) Or used something available online? Perhaps there's an event-based API in it?


Edited by grisha, 08 January 2015 - 02:13 PM.


#3 Szmycu

Szmycu

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 08 January 2015 - 02:30 PM

there is that player http://www.hdflvplayer.net/

 

Do you know exactly what the mechanism they are using(changing video source url) ?

 

Oh AJAX I dont know how to start bleh



#4 grisha

grisha

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 106 posts

Posted 09 January 2015 - 02:03 AM

I don't think they use a open-source library for that - its pretty simple to implement (tokens). Is a thing that you need to analyze (how frequently it changes) and find a workaround suitible for you.

 

You won't get a "ready to go" library solving your problem. I guess it's time to start coding :)



#5 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 13 January 2015 - 10:28 PM

Well, if it changes with session you might want to work around cookies, a proxy to change your IP Address, and your login if you log in a system to get movies.

 

So, immediately deleting that site's cookies, accessing by another IP, or with different users will be the first things to test.






Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download