I know I can set a video as 'Private', while uploading it to Youtube, by :
GDataYouTubeMediaGroup *mediaGroup = [GDataYouTubeMediaGroup mediaGroup];
[mediaGroup setIsPrivate:YES];
Is there a similar way to set a video as 'Unlisted', while uploading it ?
Thanks in advance.
Since I wasn't using an updated version of the GData APIs, first I had to make the changes listed here :
[ http://code.google.com/p/gdata-objectivec-client/source/detail?r=669 ]
Then I used the following code to set the video as 'Unlisted', while uploading it to Youtube :
GDataEntryYouTubeUpload *entry;
entry = [GDataEntryYouTubeUpload uploadEntryWithMediaGroup:mediaGroup
data:data
MIMEType:mimeType
slug:filename];
[entry addAccessControl:[GDataYouTubeAccessControl
accessControlWithAction:#"list" permission:#"denied"]];
Make sure the video is NOT set as 'Private' for this to work :
[mediaGroup setIsPrivate:NO];
Got some major help from :
[ http://groups.google.com/group/gdata-objectivec-client/browse_thread/thread/da69a5ecbb6dfa42?fwc=1 ]
Related
i am trying to add facebook share dialog into my ios application and i found the official page from facebook on how to do it, but i run into a problem about ContentProtocol. i dont know what that is. here is the link to the guidence that i use . it is pretty straight forward. basically just install the pod facebookshare, import it and add few line of code, but i got problem on 'myContent'
here is the code
import FacebookShare
let shareDialog = ShareDialog(content: myContent)
shareDialog.mode = .Native
shareDialog.failsOnInvalidData = true
shareDialog.completion = { result in
// Handle share results
}
try shareDialog.show()
here is the link
https://developers.facebook.com/docs/swift/sharing/share-dialog
what should i put in the myContent?
I guess next link is explained what you can use as content and how to use it
Content-types
(From documentation) Currently, the Facebook SDK for Swift can share 4 different kinds of content:
Links - Represented by the LinkShareContent object.
Photos - Represented by the PhotoShareContent object.
Videos - Represented by the VideoShareContent object.
Open Graph - Represented by the OpenGraphShareContent object.
you can use FBSDKShareLinkContent
let content : FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: "//URL")
content.contentTitle = "MyApp"
content.contentDescription = "//Desc"
content.imageURL = NSURL(string:"//Image URL")
Can anyone help me find out if/how you can get image data off of the 'camera roll' in an Android device, using (Appcelorator) Titanium ? I have found a 3rd party module for IOS that does this but I am desperate to find one for Android. Otherwise I'll have to scrap the Titanium and go true native.
What I need is a function that returns an array of data about the images on the device. Although I would love to get 'geolocation' data ( if it exists ), all I really need is a 'create date', and a path to the image, or the actual TiBlob.
Seems simple but i get no responses on the Appcelerator forums, which worries me. There must be at least an Android 'module' that achieves this?
Ti.Media.openPhotoGallery({
allowEditing : true,
success : function(event) {
var image = require('/modules/parts/squarecropper').crop(event.media);
setImage(image);
Ti.Media.hideCamera();
},
cancel : function() {
},
saveToPhotoGallery : false,
mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],
});
The above method would do your job. Now then either access it directly or get into a file system and encode and decode the data.
var f = Titanium.Filesystem.getFile(currIamge);
var temp = f.read();
var encodeData = Ti.Utils.base64encode(temp);
alert("encodeData = "+encodeData);
I downloaded the code DigitalDJ / AudioStreamer to use in a player I'm doing, here's the project that I downloaded: https://github.com/DigitalDJ/AudioStreamer
Have used this library before I decided to upgrade it supports multi-thread,
but when I change the address of the streaming server http:// thor.nickpack.com:9000 to the address of my server, it does not run the audio.
to replace the server path that is in a TextField in viewController to my path: http:// 184.154.37.132:7075 see my problem.
Another solution would be to modify the old player that supports multi thread, I've tried several codes and could not, that was when I found the DigitalDJ / AudioStreamer, but I came across the problem I mentioned above,
this is the link for a sample app that does not have multi thread: http://www.mediafire.com/?eb7a6a87e8tqcbc
if someone has a clue how to implement audio in backgorund or how to solve the problem of streaming server I am grateful.
after a long time and almost going crazy trying to solved the problem by commenting the code in this trexo AudioStreamer.m
// hintForMIMEType
//
// Make a more informed guess on the file type based on the MIME type
//
// Parameters:
// mimeType - the MIME type
//
// returns a file type hint that can be passed to the AudioFileStream
//
/*
+ (AudioFileTypeID)hintForMIMEType:(NSString *)mimeType
{
AudioFileTypeID fileTypeHint = kAudioFileMP3Type;
if ([mimeType isEqual:#"audio/mpeg"])
{
fileTypeHint = kAudioFileMP3Type;
}
else if ([mimeType isEqual:#"audio/x-wav"])
{
fileTypeHint = kAudioFileWAVEType;
}
else if ([mimeType isEqual:#"audio/x-aiff"])
{
fileTypeHint = kAudioFileAIFFType;
}
else if ([mimeType isEqual:#"audio/x-m4a"])
{
fileTypeHint = kAudioFileM4AType;
}
else if ([mimeType isEqual:#"audio/mp4"])
{
fileTypeHint = kAudioFileMPEG4Type;
}
else if ([mimeType isEqual:#"audio/x-caf"])
{
fileTypeHint = kAudioFileCAFType;
}
else if ([mimeType isEqual:#"audio/aac"] || [mimeType isEqual:#"audio/aacp"])
{
fileTypeHint = kAudioFileAAC_ADTSType;
}
return fileTypeHint;
}*/
with this code commented out the audio played without problems on my server
I had problems connecting to MP3 stream with AudioStreamer. The sample would work on Simulator but not on device. I think because simulator isnt exact copy of ios device. On Simulator it uses the quicktime installed on the mac.
For local MP3 files use AVAudioPlayer.
For remote MP3 streams Use AVPlayer.
A good sample project is at
https://github.com/valvoline/CPStreamPlayer
Often remote streams take time to connect to time out. This sample shows that its buffering.
Search Github for AVPlayer theres a few samples.
CPStreamPlayer/AVPlayer supports redirects so for us we had
http://stream.fireplayer.com/greyhound/dyn?action=stream.StreamMix&id=1785
BUT THIS REDIRECTED TO GENERATE Mp3 file/stream on Amazon
http://s3.amazonaws.com/fireplayer_mp3/1785.mp3?AWSAccessKeyId=AKIAJAHV5HUV4TVRF5VA&Expires=1337595252&Signature=c%2FH%2FO9AACkovm%2BAhbWyD7E9Hb6A%3D";
i'm trying to publish ogg audio files to the stream using javascript api and FB.ui,
but i can't figure out how to do it.
Here is my call to FB.ui :
FB.ui(
{
method: 'stream.publish',
message: '',
attachment: {
name: artist + ' - ' + song,
"media" : [{
"type":"mp3" ,
"src" : file,
"artist" : artist,
"title" : song
}]
}
},
function(response) {
}
);
With media type set as "mp3" the file just doesn't play, and after lot of looking around i can't figure out another audio type to specify.
Is it possible to share ogg files ?
Thanks in advance!
I'm pretty sure only mp3 format is supported. I have never seen .ogg mentioned in the documentation.
I am trying to embed Facebook video using the code below:
<object width="400" height="224" >
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="movie" value="http://www.facebook.com/v/115316011865684" />
<embed src="http://www.facebook.com/v/115316011865684" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" height="224">
</embed>
</object>
It's working fine, but is there any similar way to show video thumbnail from video id?
For example: http://www.facebook.com/thumbnail/115316011865684
or something else?
You can get the thumbnail picture from the video id by going to this Graph API URL -
https://graph.facebook.com/VIDEO_ID/picture, e.g. https://graph.facebook.com/115316011865684/picture
https://graph.facebook.com/VIDEO_ID will give you a lot more info, including bigger thumbnails to pick from. (You can get a list of the available info at
https://developers.facebook.com/docs/graph-api/reference/video.)
Here's some PHP code to dig up the biggest thumbnail:
$data = file_get_contents("https://graph.facebook.com/$video_id?fields=format");
if ($data !== FALSE)
{
$result=json_decode($data);
$count=count($result->format)-1;
$thumbnail=$result->format[$count]->picture;
}
Update: The code above has been updated since Facebook changed their API on July 10, 2017. Here is some additional PHP code to get a big thumbnail for a video in case Facebook changes things again:
$data = file_get_contents("https://graph.facebook.com/$video_id/thumbnails?access_token=$facebook_access_token");
if ($data !== FALSE)
{
$result=json_decode($data);
$thumbnail=$result->data[0]->uri;
}
This second solution requires a Facebook access token. Here are some instructions on how to get a Facebook access token: https://smashballoon.com/custom-facebook-feed/access-token/
Update: Facebook is making it more and more difficult to even get access tokens with the necessary permissions for such a simple task. Here is how to get the info from the raw HTML:
$data = `curl -s -A 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0' -L 'https://www.facebook.com/1706818892661729/'`;
if (preg_match('#<video [^>]+></video>\s*<div [^>]+><img [^>]+src="([^"]+)#s',$data,$matches))
{
$image = $matches[1]; $image = str_replace('&','&',$image);
if (strpos($image,'&')) {print "Answer: $image\n";}
}
Note that if you download the page, Facebook also provides the meta property twitter:image but that image is only 200x200. If Facebook wasn't such a pain in the butt, they would also provide the meta property og:image with a decent size image but they don't.
I just get it:
https://graph.facebook.com/VIDEO_ID?fields=format,source
This will get you an array of available formats with thumbnail URL and HTML for embeding.
Also source attribute get .mp4 url of video.
Try: https://graph.facebook.com/1706818892661729?fields=format,source
i created a php function to answer your question without you having to go through reading the boring documentation about facebook graph.
All you will need is just to insert your video link,facebook and youtube, but you can modify to add other sources.
simply copy the youtube video link in the addres bar and for for facebook, right click on the video and click on show video url, then copy that.
//get video thumbnail for facebook and youtube
function get_vid_thumbnail($link){
$thumbnail='';
//check if video link is facebook
if (strpos($link, 'facebook') !== false) {
$thumbnail=fb_thumb($link);
//$thumbnail='fb';
}
//check if video link is youtube
if (strpos($link, 'youtube.com') !== false) {
$thumbnail=youtube_thumb($link);
//$thumbnail='youtube';
}
return $thumbnail;
}
//supporting functions
//get youtube thumbnail
function youtube_thumb($link){
$new=str_replace('https://www.youtube.com/watch?v=','', $link);
$vv='https://img.youtube.com/vi/'.$new.'/0.jpg';
return $vv;
}
//clean the facebook link
function fb_video_id($url) {
//split the url
$main=parse_url($url);
//get the pathe and split to get the video id
$main=$main['path'];
$main=explode('/',$main);
$main=$main[3];
return $main;
}
//get the thumbnail
function fb_thumb($link) {
$img = 'https://graph.facebook.com/'.fb_video_id($link).'/picture';
return $img;
}
//get video thumbnail for fb and youtube ends
//get embed url for facebook and youtube to be used as video source
function get_vid_embed_url($link){
$embed_url='sss';
//check if video link is facebook
if (strpos($link, 'facebook') !== false) {
# code...
$embed_url=fb_embed_link($link);
//$thumbnail='fb';
}
//check if video link is youtube
if (strpos($link, 'youtube.com') !== false) {
# code...
$embed_url=youtube_embed_link($link);
//$thumbnail='youtube';
}
return $embed_url;
}
//get youtube embed link
function youtube_embed_link($link){
$new=str_replace('https://www.youtube.com/watch?v=','', $link);
$link='https://www.youtube.com/embed/'.$new;
return $link;
}
//get facebook embed link
function fb_embed_link($link) {
$link = 'https://www.facebook.com/plugins/video.php?href='.$link.'&show_text=0&width=560';
return $link;
}