I know this question was asked a lot, many of them were answered by viewing the source code, in my case it didn't work, using Internet Download Manager, i got the following link :
rtmp://178.162.202.6/live/fsdlfmlll2?id=247301&pk=a9930efdccdd78b9c127ef17a4150224b859aa6d3ec13c11129a10fd54edf7dd
This link is valid only on IDM, but on a player it's not, I'm trying to get the rtmp from HERE (Press any streaming item, for updated links) .
The source code doesn't include anything related to rtmp, and the " Inspect Element / Network " is adding these :
http://www3.javabin.xyz/swf/57163b78560f4-7246945710.swf
http://www3.javabin.xyz/swf/833.m3u8?sf=NTcxNjNiNzg1NjBmNA==&token=M3mEC-3m9nJVB1WzLxTN4Q
You have two options. The shown code can be previewed by testing here.
(1) Embed the video directy from DailyMotion (using i-frame) :
<html>
<body>
<iframe width="720" height="480"
src="http://www.dailymotion.com/embed/video/x482s3s?autoplay=0">
</iframe>
</body>
</html>
Use autoplay=1
if you want it to play automatically.
(2) Get URL from middle-man (a link downloader) :
The video you want is server-protected. That means here the server makes a temporary access token for each connection. One link today will not always work tomorrow because that token has expired. So each time you must know how to create a fresh token for access. Since that is difficut we use a next system (middle man) that can already do it for us....
For example using this downloader site as middle-man, GetVideo.at, you can get a JSON array of links by giving the url http://getvideo.at/search?q=VIDEO_URL
where VIDEO_URL is your link to video page (Dailymotion, Youtube, Vimeo etc).
(2.1)
So regarding your Dailymotion video that link looks like :
http://getvideo.at/search?q=http://www.dailymotion.com/embed/video/x482s3s
When you got to that above link you get a JSON object (text) something like this:
{"video_formats": [{"quality": "240", "filename": "skipback_20160501_1600 (06).mp4", "url": "/download?id=064398ee-1d20-11e6-865b-06c0b400153d", "format": "mp4"}, {"quality": "384", "filename": "skipback_20160501_1600 (06).mp4", "url": "/download?id=064405a4-1d20-11e6-865b-06c0b400153d", "format": "mp4"}, {"quality": "480", "filename": "skipback_20160501_1600 (06).mp4", "url": "/download?id=06442dd6-1d20-11e6-865b-06c0b400153d", "format": "mp4"}, {"quality": "720", "filename": "skipback_20160501_1600 (06).mp4", "url": "/download?id=064462a6-1d20-11e6-865b-06c0b400153d", "format": "mp4"}], "thumbnail": "https://s1-ssl.dmcdn.net/Wp3_C.jpg", "audio_formats": [], "duration": "02:42", "title": "skipback_20160501_1600 (06)"}
(2.2)
As you can see, for a Quality : 240p video the URL
is :
/download?id=064398ee-1d20-11e6-865b-06c0b400153d
So to play MP4 we combine http://getvideo.at
with text extracted from shown URL
from JSON. So the final link playable in HTML5 video tag (src=
) is like this :
http://getvideo.at/download?id=064398ee-1d20-11e6-865b-06c0b400153d
(2.3)
Use it as <source src="http://rest of link"
when setting up the video tag.
<html>
<body>
<video id="myVideo" width="400" controls>
<source src="http://getvideo.at/download?id=471c4a8a-1b24-11e6-9917-06c0b400153d" type="video/mp4">
Your browser does not support HTML5 video.
</video>
<p> Original Source : DailyMotion. </p>
<script>
var vid = document.getElementById("myVideo");
vid.volume = 0.2;
</script>
</body>
</html>
NOTE: I don't use Ruby, to use this second method, your app must always check that Getvideo.at
link for a JSON of the correct links. JSON is just text... So either use Ruby's JSON parser or just use String functions to extract the link text. If you put that link to a String variable you can do something like below in the video tag:
<source src=$myLinkString type="video/mp4">