Locally store vimeo videos on my phone (Phonegap Build APP) - javascript

I have a problem with a mobile app that I'm developing in HTML, CSS and Javascript to compile with Phonegap.
What happens is that so far the videos have been playing from an iframe on Vimeo, but now it is necessary that they can be stored locally on the phone for offline playback.
Does anyone have an idea of ​​how could I do that? I do not know if with any API or with the native android player could be done.
Thank you very much for any help.

The following two conditions must be met to gain access to the .mp4 video files.
You uploaded the videos (so you own them)
You are a PRO Vimeo user.
I haven't worked with Phonegap before but I have some perspective on Android. The easiest way to get the URL via Android code is through the the Vimeo API. There is a Java library for interacting with the Vimeo API here which will allow you to request Video objects for the videos you own (probably by hitting the /me endpoint).
This section of the README.md should be helpful in understanding how to get access to fields on the Video object (but you should read the whole thing to get it set up).
Once you have a Video object, you can access the download field which is an array of VideoFiles which will contain a link to an .mp4 file that you can pass to any file downloader. The code would look something like below:
Video myVideo = ...// Some video retrieved from the API
if(mVideo == null || mVideo.download == null || mVideo.download.isEmpty()) {
// Throw an error
}
VideoFile videoFileToDownload = mVideo.get(0);
// The url to the mp4 file
String videoFileUrl = videoFileToDownload.mLink;
download(videoFileUrl); // You'll need to make a method to download
The two holes are 1) how to get a video and 2) how to download a file. The first question can be answered by the vimeo-networking-java library's README. The second question should be easy enough to find a solution on Google (downloading a file given a link to an .mp4 file).

Related

Video Streaming from an object storage

As the title depicts I am trying to stream a video from an object storage i.e minIO.
Use case : I am working on social media application for a feature called "reels" aka short videos and storing the saved videos to minio.
Problem : While scrolling through the already posted videos I am finding a buffer lag between the videos as we are accessing the videos using the url generated by the minio server.
My approach : I have planned to introduce a streaming server which can stream videos from the object storage as mentioned above which can solve the buffering issue.
I have gone through the following open source servers,
nginx rtmp
apache flink
While going through the above I am unable to find proper documentation where it fetches a video from object storage and streams it to the application.
Help?
I would like to know the following,
if the above approach is right and if its right how do I configure these servers to fetch from minio.
if this isn't right would be helpful if you could assist me with another approach.

Getting duration of Youtube Video for Chrome extension

I'm new to Javascript and making Chrome Extensions (I have experience with Python/Java), so please be patient with me. I'm trying to make a chrome extension, and one part requires the duration of a youtube video. I know I need to use the Youtube API, specifically - contentDetails.duration - which returns the length of a video.
I've created the manifest.json file and a .js file that contains some basic framework for using the youtube api. My question is, how exactly do I use all the features for the youtube api? Like Do I just set some variable equal to contentDetails.duration like length = contentDetails.duration? Do I need to input some key somewhere (I got the api key already). Do I put this in the .js file after the search(); in function onYouTubeApiLoad()?
Could someone go into the basics of how to use this method? Thank you so much.
The Youtube API you provided is an HTTP API. This means that you have to send an HTTP GET request, and Google's server will reply with a response. The standard way to create HTTP request from Javascript is to use either XMLHTTPRequest or fetch.
You can demo the API here: https://developers.google.com/youtube/v3/docs/videos/list#try-it
Unfortunately, the APIs are rate-limited and require authentication. To get full access, you have to pay Youtube money. This means that users of your extension won't be able to call the Youtube API.
You're better off having users
1. Open the web page containing the video
2. Query the document for the element
3. Read the duration property to get the length in seconds.
To see what I mean, try entering the following in the Javascript console of a youtube video page.
document.querySelector('video').duration

HTML5 audio - recording saves file OK, but no sound when playing back through audio control

I have an asp.net web application that allows a user to record audio. I'm using code from https://github.com/nusofthq/Recordmp3js along with Matt Diamond's recorder files (modified for wav instead of mp3). Not sure if it matters but I'm using the updated API for mediaDevices.getUserMedia().
The recording works fine, the wav file is saved to disk, and if I listen to the file on disk I can hear the recording. However, if I try to play the audio back through the HTML5 audio control on the page, there is no sound. The length of the file matches what is on disk so I don't think it's because the audio control is unable to find the file.
I can post my Javascript if that will be helpful. I'm currently testing on localhost using Firefox. Firebug doesn't show any errors.
Please let me know if any additional information may be helpful.
Thank you!
The (quickest) solution was to reset Firefox. Wav files now play without any issues.

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

Can I play iTunes song previews in an HTML page?

I need to show on my site search results from the iTunes Store, including previews of audio tracks.
I could use the iTUnes search api to return JSON info with cover image, title and other info. But for previews url I have problems (like following http://a5.mzstatic.com/us/r1000/007/Music/2f/18/8c/mzm.dsmmvsnn.aac.p.m4a).
It is not direct link to file but to some streaming server (not sure it is RTSP, network sniffer shows some other). It could not be dowloaded directly by browser, flash and HTML5 players don’t support it, and it couldn't be opened even using QuickTime Player. So I haven't found any way to embed it to site web page like I do for regular audio/video links.
The only program that could open such urls is iTunes. But as far as I could see it couldn't be used as embed/object in browser/web page.
Any ideas how it could be implemented?
As far as I understand iTunes not allows previews to be played for countries with no iTunes store.
So preview plays in Itunes application and not in quick time or any other player. So such case really difficult to catch (if it will not play in itunes app it will be clear and easy to detect, but in this case not).
After using proxy or just testing from other location all become working. And could be integrated using many flash players.

Categories

Resources