how to include the video source using javascript

Asked

Viewed 234 times

1

how to include the video source using javascript without printing the final code in the browser (with the element inspector)? I’ve been thinking about several ways, even though I currently deem it impossible, but I’d like your opinion on that. I use a custom player with css made by myself, and I can’t use flash.

  • What do you mean "the video source"? a font of the text? or the url of the video?

  • You want to soak a video whose origin can not see seen in any way ?

  • source = source yes, maybe apply some token or something that only allows my site to view. Only the idea would help =P but an orientation would make me a fan of the kkkk =P person

  • This question has a certain time, but reading it I had an idea: apply the concept of CORS on your service that provides the video, allowing only requests from your own domain, this might help you solve the problem of third parties using your video?

  • Interesting idea Fernando, vlw =D

1 answer

0


I don’t think it’s possible to make the video URL not appear in the source code when the element is inspected, but you can always obfuscate the code making it harder to read with the naked eye using tools like Source Code Encrypter etc..

A normal code that would be:

<video width="400" controls>
    <source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
    <source src="http://www.w3schools.com/html/mov_bbb.ogg" type="video/ogg">
    Your browser does not support HTML5 video.
</video>

This is how it will be:

<script>
<!--
document.write(unescape("%3Cvideo%20width%3D%22400%22%20controls%3E%0A%20%20%3Csource%20src%3D%22http%3A//www.w3schools.com/html/mov_bbb.mp4%22%20type%3D%22video/mp4%22%3E%0A%20%20%3Csource%20src%3D%22http%3A//www.w3schools.com/html/mov_bbb.ogg%22%20type%3D%22video/ogg%22%3E%0A%20%20Your%20browser%20does%20not%20support%20HTML5%20video.%0A%3C/video%3E"));
//-->
</script>

However, as you can see, if you repair well you can still see the source/URL of the video but you can make things even more difficult, such as using URL shortening services such as goo.gl or the bit.ly so that the URL passes unnoticed in the middle of all this code or create a URL just for hosting videos that is not so obvious, as for example Twitter uses the t.co, if you use a URL of the same style it will not draw as much attention when encrypted along with the rest of the code.

Domain example: http://0.me that will be - 0.me/meuVideo.mp4 or 0.me/g16dfs.mp4.

document.write(unescape("%3Cvideo%20width%3D%22400%22%20controls%3E%0A%20%20%3Csource%20src%3D%22http%3A//0.me/g16dfs.mp4%22%20type%3D%22video/mp4%22%3E%0A%20%20%3Csource%20src%3D%22http%3A//0.me/g16dfs.mp4%22%20type%3D%22video/ogg%22%3E%0A%20%20Your%20browser%20does%20not%20support%20HTML5%20video.%0A%3C/video%3E"));

Or you can increase the amount of code being encrypted to make it harder to read. However, you can always reach out and decrypt the code using the developer’s tools. So this will only be more effective for those who don’t know much about code or who are beginners in the area of web development.

  • 1

    Thank you friend, I believe that in fact, still, there are conditions for what I would like, but I appreciate the suggestions. =)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.