I'm trying to do Browser-based upload from android. In the first steps, the mobile asks my server to get a url and token from youtube. after the mobile got if from the server, the mobile uploads the video to youtube. But sometimes a "Connection Reset By Peer" exception is thrown, after the video was uploaded and can be seen on youtube. How can I avoid this error, or at least check if the video was uploaded correctly?
and another thing, I don't get the youtube_VideoId in the response (in the case there is no exception).
this is the code for the uploading step:
File file = new File(fileName);
try {
HttpClient client = new DefaultHttpClient();
String postURL = url + "?nexturl=http://example.com";
HttpPost post = new HttpPost(postURL);
FileBody bin = new FileBody(file);
MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
reqEntity.addPart("email", new StringBody("XXX#gmail.com", "text/plain", Charset.forName("UTF-8")));
reqEntity.addPart("token", new StringBody(token));
reqEntity.addPart("uploadfile", bin);
this.totalSize = bin.getContentLength();
post.setEntity(reqEntity);
HttpResponse response = client.execute(post);
HttpEntity resEntity = response.getEntity();
Connection reset maybe a happening if there are really long videos. I know there was a bug open for more than an hour connections.
You can check YouTube direct Lite for Android project to poll about video status and processing status.
Related
i have an AJA HELO media streaming device and from time to time it stops streaming. What i want to do it automate some kind of streaming reset. I am able to issue command to the AJA to stop and start streaming, but i need help figuring out how to "End Stream" on my current Youtube Live stream. Just doing so on the AJA does nothing since Youtube still thinks the stream will be back shortly.
Does anyone know of a way to achieve this?
P.S. i am able to retrieve the exact stream identifier via a Python script, as i am monitoring the state in an NMS.
Thanks
I'm not sure if this is directly related, but to end a livestream using the Python google-api-python-client library:
youtube = build("youtube", "v3", credentials = [YOUR CREDENTIALS])
request = youtube.liveBroadcasts().transition(
part = 'snippet',
id = [VIDEO ID OF THE LIVESTREAM],
broadcastStatus = 'complete'
#Setting the 'broadcastStatus' to 'complete' ends the stream
)
response = request.execute()
You can find more details about this in the docs here (including POST): https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/transition
I want to play twilio media stream in browser in real time. For this I am using websocket to send twilio stream from node.js server to browser. I am converting the twilio media stream by using wavefile npm with the following code :-
// Server Side Code
const wav = new WaveFile();
wav.fromScratch(1, 8000, '8m', Buffer.from(item.audioPayload, "base64"));
wav.fromMuLaw();
wav.toSampleRate(44100);
let dataURI = wav.toDataURI();
item.audioPayload = dataURI;
this.sendAgentMessage(item, this.connection);
And at the browser side I am playing audio using this :-
// Client side code
var snd = new Audio(message.audioPayload);
snd.play();
Now while playing the audio I am getting very much noise and distortion.
Please help me with this.
I found this: https://github.com/VineAPI/VineAPI/blob/master/endpoints.md
I have following Some Process for share video on vine app.
1.Login:https://api.vineapp.com/users/authenticate
Authentication successfully using above doc lin API. I have received a key(session key).
for another Process.
After that use the next Api for Upload Video thumbnail On Vine.
2.thumnails
https://media.vineapp.com/upload/thumbs/1.3.1.mp4.jpg
Thumbnails successfully uploaded On vine and received the server response
get the uploaded thumbnails URL in X-Upload-Key. You can see the Above image.
3.Upload Video:https://media.vineapp.com/upload/videos/1.3.1.mp4
Video Data successfully uploaded On vine and received the server response
get the uploaded Video URL in X-Upload-Key. You can see the Above image.
4.Create Post:https://api.vineapp.com/posts
Post successfully create On vine and received the server response
{
code = "";
data = {
created = "2016-04-18T09:27:20.000000";
permalinkUrl = "https://vine.co/v/iFaqLt7w5Qm";
postId = 1333777877887795200;
videoUrl = "http://v.cdn.vine.co/static/private_post_old_client.mp4";
};
error = "";
success = 1;
}
When Open the permalinkUrl = "https://vine.co/v/iFaqLt7w5Qm"; get error message.You can see in Image
and aslo open link on browser
http://v.cdn.vine.co/static/private_post_old_client.mp4
Video autometically download but video did not download actual video.show some message On Video Like this.
Please Help me.Have you any Idea.
Finally I did it,
Just change the setting of AVAssetExportSession before exporting the video to save.
self.exportSession = [[AVAssetExportSession alloc] initWithAsset:mixComposition
presetName:AVAssetExportPreset640x480];
self.exportSession.outputFileType = AVFileTypeMPEG4;
I have downloaded the sample code of the below path
http://www.codeproject.com/Articles/143669/Manage-YouTube-using-C-and-Youtube-API-1-6
Then I have installed the YouTube_SDK_2.1.0.0.msi
Now I can build the project successfully, but when I want to search a video in the Youtube
the AtomFeed of the videofeed will return the Error=NoLinkedYouTubeAccount
Please tell me what happened, I already surveyed some days in network.
Sample code list as below
yousettings = new YouTubeRequestSettings("My AP", devkey, username, password);
yousettings.Credentials.AccountType = "GOOGLE";
.........
videofeed = yourequest.Get<Video>(new Uri(feedUrl));
videofeed will always return fail then the Sample Ap will be crashed, the crash info list as below:
An unhandled exception of type
Google.GData.Client.GDataRequestException occurred in
Google.GData.Client.dll Additional information: Execution of request
failed:
http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?time=today
Note:
I have link the Youtube account to the Google account.
I try to modify the yousettings.Credentials.AccountType = "GOOGLE";
FeedUri = "http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?time=today"
I need to send the device token required for push notification in iOS to urban-airship server from the actionscript code. How can i do that? I am using their API's in my app. I am just using urban-airship to test push notifications on my app.
Since their url requires user authentication, I want to write code so that authentication happens silently without generating the pop dialog.
I finally figured out myself how to solve this problem:
// AIR developer can send the tokenId received in event.data to his server via URL request
var urlRequest:URLRequest;
var urlLoader:URLLoader = new URLLoader();
var tokenId:String; //tokenId received after registering for push notifications
var urlString:String = "https://go.urbanairship.com/api/device_tokens/" + tokenId;
urlRequest = new URLRequest(urlString);
urlRequest.authenticate = true;
urlRequest.method = URLRequestMethod.PUT;
URLRequestDefaults.setLoginCredentialsForHost("go.urbanairship.com",<userId>,<password>) ;
urlLoader.load(urlRequest);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, onError);
urlLoader.addEventListener(Event.COMPLETE, onComplete);
urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onStatus);