How to get video data/stream which play on page with javascript? - javascript

Perhaps this is an unprecedented problem, because I have searched the Internet and there seems to be no feasible solution to this problem.
I'm making a chrome extension for download video. I can inject my javascript into the video webpage on another site. I need to get the cached data or stream played in the <video> with this script, and then save it in blob for downloading.
I've tried MediaSource and captureStream+MediaRecorder, but it doesn't seem to solve my needs. Is there any other API that can realize this function?

Related

Is there any way to trim YouTube video without downloading it to local machine?

I am creating an app to trim video where a user either can upload the video file or can paste YouTube URL.
I am able to make the trimmer work for upload video using FFmpeg, but for YouTube URL, firstly I need to download the video to the local machine and then trim it using FFmpeg.
I am using youtube-dl NodeJS library to save the video file to locally, but the issue is as I am allowing the user to download only 15Sec video no more than that, and I have applied validation of 60m long video, yet when I get 1080p video there are two issues.
1. There is no audio in the 1080p video.
and
2. The video is taking too long to download locally and the process is taking almost 7-8mins to complete.
For the first one, I can get the audio and video separately and then merge both of them in the video, but the second one is where I am stacked.
I have added a time log I can see the trimming is taking only about 3-4 seconds, but the downloading is taking too long.
Is there any way to make it work faster? Or, Is there any way I can download only that part of the video, not the full video, in any technology.
I am open to using any technology until it is working faster than my current implementation.
If this is something related to server configuration, please suggest which one would work better.

How can I play a youtube video in a windows 8 store app (javascript)

I've tried a lot of different solutions on the web but none seem to work. Given a youtube key "8sPj0Ic8KQ8" I want to play the video in a Windows 8 metro-style javascript app.
Simple , and tags do not work, no surprise there. My next stop was the Player Framework for Windows 8 Metro Style Applications and Smooth Streaming Client SDK. The examples work since they point to an mp4 file but when I paste a youtube url into the example even that doesn't work.
Next, I noticed there is a "MyTools" framework out there but it's only for C#/Xaml and not javascript. Furthermore the code is not supplied, only DLLs so I don't think converting it is an option.
I also tried WinJS.Utilities.setInnerHTMLUnsafe() suggested here - just get a white box, no video.
Finally, I queried youtube directly for the full page contents and I've been attempting to parse out the mp4 URI myself... without much luck. I also found a PHP library to do what I'm attempting but after converting it to javascript it seems it's either really old or just doesn't work right.
I also tried "?html5=1" in an iframe suggested by this book: Start Here windows 8 with HTML
If anyone has another suggestion I haven't tried or if you've successfully played a youtube video in a javascript metro app I'd be very interested to hear how you did it. Thank you.
UPDATE: I've now been able to successfully extract the mp4 file data from a youtube page. This will let me download the stream to my computer but I'm still unable to play it in a Windows 8 app, all I get is a white box with no controls or error messages. I want users to see videos, not save them.
Finally solved this. The answer is to A) parse the actual URI from the youtube page. B) Use the Microsoft.SmoothStreaming library in combination with a C) video tag. This got youtube videos to play for me in Windows metro style app. If you need help with part A, this site helped me a lot: How to grab youtube playback video files

Temporarily store audio file with JavaScript

I'm currently building a web application that requires a fairly large audio file (~50mb) to be accessible offline.
I attempted this with fetching a base64 string of the audio file from the web server, then modifying the DOM by adding an audio element that points to the base64 string with using data:. However, this does not work in Chrome for Android; due to this bug.
I'm wondering if there's a better solution to the problem that works on Chrome for Android.
Thanks in advance.

Simple way to embed locally-hosted video using HTML, Javascript, or jQuery

I need to put a video in a webpage such that when the page opens, the video will be visible and start playing when the user clicks it. The video file is in .wmv format and stored on the same server that hosts the webpage. I read in some places that it's not easy to get embedded video to work across all browsers, so I'm looking for the simplest way to accomplish that, be it HTML, Javascript, or jQuery. I'd rather not convert the video file or store multiple copies of it if there is a way to not have to do that.
You will need to convert your video at least once due to WMV being a proprietary format (that, and as far as I know, the only way to play a WMV is through Windows Media Player activeX add-ins), which, sadly, means multiple copies if you want to deal with all navigators.
Your tool of choice in this is something like jwplayer (http://www.longtailvideo.com/jw-player/). MP4 works on some, while WEBM works on others, and thankfully, flash can read MP4.
Sébastien Renauld and Blazemonger said it.
You can't stream your wmv (windows media video) video across the web reliably because many browsers won't support it.
As Blazemonger said, uploading to YouTube or another video hosting site will take of this for you. They will also provide an embedded url for you which can be sent to all your friends.
Otherwise, as Sébastien Renauld pointed out, you'll need to convert the video into an h.264 .mp4 video AND another format like .ogv or .webM. mp4 is supported by most browsers but not FireFox, which is why you need a second format. Both .ogv and .webM are supported by FireFox.

javascript to discover .flv url from any embedded flash video?

Is there any javascript library out there that can find the url to the flash video file (.flv) on current page where it has an embedded flash video player? Ex. opens collegehumor.com video link, shows flash video url.
I have been looking through codes from chrome extensions which discovers flash video links for download but no dice.
Browser extensions can look into Flash internals and monitor your HTTP activity to see where data is being pulled from, however Javascript running in the document does not have permission to read either of those.
Some Flash apps expose some of their internals to Javascript, but they need to specifically write in that functionality, and for third parties this would be documented, presumably as an API. As far as I can tell, collegehumor doesn't provide any of that.

Categories

Resources