Media Player Error in Android error(1, -2147483648) - android

I am using MediaPlayer to play my video from a URL that I have parsed from a Youtube json-c feed. The feed I retrieved is:
"player":
{"default":"https://www.youtube.com/watch?v=4uwtqRBE4Kk&feature=youtube_gdata_player",
"mobile":"https://m.youtube.com/details?v=4uwtqRBE4Kk"},
"content":
{"5":"https://www.youtube.com/v/4uwtqRBE4Kk?version=3&f=videos&app=youtube_gdata",
"1":"rtsp://v3.cache1.c.youtube.com/CiILENy73wIaGQmp4EQQqS3s4hMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp",
"6":"rtsp://v3.cache2.c.youtube.com/CiILENy73wIaGQmp4EQQqS3s4hMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp"},"
I am using
//URL I retrieved from a json-c feed from the player array described above
private String URL = "https://m.youtube.com/watch?v=4uwtqRBE4Kk";
mediaplayer.setDataSource(URL);
It gives a MediaPlayerError error(1, -2147483648). Whereas when I use the URL from a dropbox like
private String URL = "http://dl.dropbox.com/u/145894/t/rabbits.3gp";
It runs and the video is played. Please explain the error or give me a remedy.

If you are testing on devices earlier than Android 3.1 you might not be able to play AACP.
In order to find out what streams you can play on your targeted device check official docs: http://developer.android.com/reference/android/media/AudioManager.html
If you are looking how to handle aacp checkout following:
https://stackoverflow.com/a/8833346/200272

Related

How to get the Youtube video info on our application?

I saw on many applications that they can get the info of current playing youtube video's title, duration etc on there application.
See this response
title: Desiigner- Panda (OFFICIAL SONG) Prod. By: Menace
album: null
artist: Desiigner LOD
duration: 248000
position: 33154
positionTimestamp: 438260822
source: com.google.android.youtube
playing: true
artworkUri: null
supportedActions: 560
May I know how I can get this info on my application ?
Well, if you want to get data for Youtube Videos or play Youtube Videos on your app etc. you can use the YouTube Data API. It's easy to integrate and it's Google's official API for getting video data from youtube. If you want to use the whole Youtube API you can also look at the documentation. You can look at the Github samples for the API. Good Luck!
They get this information via logcat:

Is there any way to retrieve only completed video not live streaming?

HI I am developing an android app. I'm using Youtube API v3.
As I mention on question title, Is there way? because I send command to Youtube server, they return video and live streaming.
I tried to find options to exclude live streaming video but I couldn't.
Try using videos.list to retrieve non-livestreaming videos in Youtube. Use the HTTP request
GET https://www.googleapis.com/youtube/v3/videos
to perform the operation.
Give the Try-it a go to see the results in your browser right now.
Since you're using Android, this code snippet from the same page might give you an idea:
// Call the YouTube Data API's youtube.videos.list method to
// retrieve the resources that represent the specified videos.
YouTube.Videos.List listVideosRequest = youtube.videos().list("snippet, recordingDetails").setId(videoId);
VideoListResponse listResponse = listVideosRequest.execute();
List<Video> videoList = listResponse.getItems();

Universal Music Player with own JSON and Youtube Audio Library

As mentioned in this line:
private static final String CATALOG_URL =
"http://storage.googleapis.com/automotive-media/music.json";
This file contains a list of tracks that are hosted by Google online.
So, I guess the complete URL of Jazz_In_Paris.mp3 would be
https://www.youtube.com/audiolibrary/music/Jazz_In_Paris.mp3
but getting 404 Not Found in a same way I have tried
https://www.youtube.com/audiolibrary/music/album_art.jpg
but again same result 404 Not Found
So here are my few small questions:
1. What is the complete URL of `Jazz_In_Paris.mp3` and `album_art.jpg`
2. Where they have used site object "site" : "https://www.youtube.com/audiolibrary/music" in application (in which class and where)
3. Where I have to make changes in my code, If I would like to get JSON from my own Server "http://www.domain.com/services/music.json"
4. How can I create my own Youtube Audio Library, Like in my Library I would like to add my favourite youtube songs
What is the complete URL of Jazz_In_Paris.mp3 and album_art.jpg
http://storage.googleapis.com/automotive-media/album_art.jpg
http://storage.googleapis.com/automotive-media/The_Messenger.mp3
Where they have used site object "site" : "https://www.youtube.com/audiolibrary/music" in application (in which class and where)
this url not used any where in app.
Where I have to make changes in my code, If I would like to get JSON from my own Server "http://www.domain.com/services/music.json"
yes, you can use same json for your app but just change path to your server(just create same json format)
How can I create my own Youtube Audio Library, Like in my Library I would like to add my favourite youtube songs
Universal Music Player: use Google storage client to store music files but you can also create own you tube channel and make private video. use it in your app
EDITED:
"site" json object is useless. this object is json because of previous version of app they have used that. currently not.
youtube channel and Google storage both are different thing. Google storage mainly used to store files which we are able to use in our app.
in you tube every one can upload video which is private/public(if you are going to use that in your app then use private). for more detail check you support articals
i suggest you to use Google Storage API or you can also upload files on your own server!

Android app - private viemo videos not playing

I'm currently developing an android mobile app. I see that private Vimeo videos are not playing. Check the attached screen shot. Also note that the android app is still on development mode and not uploaded to Google. Please help me in this regard.
Regards,
Niladri!
private vimeo video not playing
That picture appears to be accessing vimeo.com directly to view videos. At vimeo.com, private videos can only be viewed if you are logged in (which is unrelated to the API).
If you want to play a private video in your application you will need to follow one of the following workflows:
Embedded in a webview
Mark your video as hidden from vimeo, yet embeddable, in your video's settings
Make an API request to /videos/{video_id} and extract the embed code from the response body (response.embed.html)
Put the embed code in your webview's html
Played in the Native Player (Vimeo PRO only)
Mark your video with any privacy setting
Make an API request to /videos/{video_id}
Find the collection of video files (response.files)
Loop through the video files to find the best height and width for your target player
Load the link into your native player
You can read more about the Vimeo API at https://developer.vimeo.com/api, and https://developer.vimeo.com/api/endpoints
If you want to play private Vimeo videos of your Vimeo account in an Android Application then follow the steps below:
Go to your video privacy settings and mark it as hidden from Vimeo and embed anywhere.
Make an API request to this endpoint: https://api.vimeo.com/users/{your_user_id}/videos
Get the embed.html string from the API response.
Load embed.html obtained in the previous step into your WebView.
For Vimeo Android SDK: https://github.com/vimeo/vimeo-networking-java
You can retrieve the Video endpoint by calling an auth-enabled REST API and then play it using a player(I used Exoplayer in android).
Follow below steps:
API Registration: You will need an application registered with the Vimeo API. If you do not already have an application registered, you can do so here.
You can generate an access token in the Authentication tab once you select your app from the list here.
With this access token you'll be able to make any requests that the access token's scope allows. You will NOT be able to switch accounts if you only supply the access token.
Call rest API with the access token in the header like below
Endpoint:
https://api.vimeo.com/videos/{VIDEO_ID}
Header:
Authorization:bearer ACCESS_TOKEN
VIDEO_ID is the id of video uploaded to Vimeo(Some number eg: 45334535)
ACCESS_TOKEN is the token you got after API Registration
This steps worked for me. I hope this will help someone.
We have a special google's SDK for YouTube for instance. On the other side AOS does not support Adobe Flash. Maybe its just has an unsupported by AOS video codec used by vimeo service? That could be the reason why you cant watch vimeo videos via WebView/browser.
Did you check for Vimeo official Android SDK if such thing does exist at least?
Also check this
And a little suggest: try to use SO search and google - it helps in most cases :)

Phonegap Media API trying to access audio locally

I am currently working on an app that has to play audio from an external source. It is in the .amr file format, but giving it the URL and looking at log cat I can see its trying to access it locally logging:
FAILED renaming /storage/sdcard0/tmprecording.3gp to /storage/sdcard0/http://URL/audio.amr
Here is my player code
function play(source) {
var media = new Media(source, Played, Failed);
media.play();
document.getElementById('status').innerHTML = "playing";
}
with the function linked to a button and given a URL to the audio. I am testing this out on Android.
Thanks!
Never mind, it was just an issue with formats, .amr is an incompatible format so it didnt work

Categories

Resources