I am uploading videos to you tube from my iOS application using GData. But I want to change the access control property of the videos to "unlisted". So that, only people using my application can view the video.
I tried to use the function:
+ (GDataYouTubeAccessControl *)accessControlWithAction:(NSString *)action
permission:(NSString *)permission
in "GDataYouTubeAccessControl.h" for this, but it does not have "unlist" in the constants.
Is there any way to do this?
I did the following to upload a video as 'Unlisted'.
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'm trying to establish a simple audio stream to a Chromecast device. This is just a POC for me to familiarize myself with the API. What I want to do is load up the user's library, select a song, and have it cast over. I've been following the integration guide quite closely but to no avail.
Please find the full project on Github here.
An overview of my code, AppDelegate.m:
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
GCKCastOptions *options = [GCKCastOptions.alloc initWithReceiverApplicationID:kGCKMediaDefaultReceiverApplicationID];
[GCKCastContext setSharedInstanceWithOptions:options];
[GCKCastContext.sharedInstance.sessionManager addListener:self];
}
UITableViewDelegate:
- (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath
{
MPMediaItem *mediaItem = MusicManager.sharedManager[index];
NSString *path = [MPMediaLibrary.defaultMediaLibrary pathForAssetURL:mediaItem.assetURL];
GCKMediaMetadata *metadata = [GCKMediaMetadata.alloc initWithMetadataType:GCKMediaMetadataTypeMusicTrack];
[metadata setString:mediaItem.title forKey:kGCKMetadataKeyTitle];
[metadata setString:mediaItem.artist forKey:kGCKMetadataKeyArtist];
[metadata setString:mediaItem.albumTitle forKey:kGCKMetadataKeyAlbumTitle];
GCKMediaInformation *mediaInfo = [GCKMediaInformation.alloc initWithContentID:path
streamType:GCKMediaStreamTypeBuffered
contentType:[self fileMIMEType:path]
metadata:metadata
streamDuration:mediaItem.playbackDuration
customData:nil];
[GCKCastContext.sharedInstance.sessionManager.currentCastSession.remoteMediaClient loadMedia:mediaInfo autoplay:YES];
}
I initiate the casting session by tapping the GCKCastButton and Start Session, my TV shows the Cast logo, then when I tap on a specific song, my TV briefly shows the metadata (i.e. song title, artist name, etc.), and then reverts back to the Chromecast logo. On the device, if I remain on the screen presented by GCKCastButton, I can also see the details of the song that is supposed to be currently casting, but quickly changes to "No Media Selected" after a few seconds.
I've checked the file path, the MIME type, everything is correct and playable. I've even tried bundling a short MP3 and trying to cast that, but to no avail.
Can't help but feel like I'm missing something here, the integration guide doesn't really give much more info.
Any insight is appreciated. Thanks!
It seems that I was under the wrong impression that the cast library initiates a stream from the provided file itself. But instead it required an actual URL for the Chromecast device to perform a GET operation on.
I imagine this will be solved by running a server locally on the iOS device.
I have made an iOS application using built.io. There are several files uploaded in the application. However, i am unable to get the list of all the files uploaded in the app. Could anyone please help?
This can be done via BuiltFile class instance method fetchAllOnSuccess:onError:
It returns all files uploaded in your built application only if the requesting user has permission for it.
Built* builtfileObj = [Built file];
[builtfileObj fetchAllOnSuccess:^(NSArray *allFiles) {
// allFiles contains array of BuiltFiles
} onError:^(NSError *error) {
// there was an error in creating the object
// error.userinfo contains more details regarding the same
}];
To fetch all the uploads, the iOS SDK provides an instance method in the BuiltFile class. It returns an array of all the uploads.
Here's the link to the official documentation
http://static.built.io/downloads/sdk-docs/ios-docs/Classes/BuiltFile.html#//api/name/fetchAllOnSuccess:onError:
I dont know if its available in the iOS SDK but you can use the REST API to fetch it
Headers :
"application_uid: uid"
"application_api_key: api_key"
URL: GET : https://manage.built.io/v1/uploads?skip=0&limit=50&include_count=true
Params : skip and limit for pagination and include_count is for getting the total count.
The above url will fetch all types of files
But if you want only images or videos then you can use the below urls
https://manage.built.io/v1/uploads/images
https://manage.built.io/v1/uploads/videos
I hope i was helpful to you!!
Note : without the headers the API wont work
I have a question.
Recently I needed to add custom tags for recorded video. Local video on device not a streamed video. The task is to add some event specific tags in video, position of which could be set by pressing forward/backward like buttons like in any player.
It is not important whether the movie file will be mov file or mp4 format.
I searched on forum, found several samples how to add metadata using AVExportSession & it worked.
Although, when I tried to add metadata using AVAssetWriter. I wasn't able to append attributes to video.
What I do not understand is that after adding attribute, returned (time & duration) properties are always invalid.
For instance let's say I have a video with duration 2 seconds.
I have tried different key spaces. I am not able to write keys' from ID3 space.
IS ID3 used for stream video? (as far as I understood ID3 metadata of .mp3). Therefore, I was not able to write it into MPEG-4 file
I also used QuickTimeUserData & ISOUserData but again results are the same.
Here is an example
AVMutableMetadataItem *item2 = [AVMutableMetadataItem new];
item2.keySpace = AVMetadataKeySpaceiTunes;
item2.key = AVMetadataiTunesMetadataKeyUserComment;
item2.value = #"One two three";
item2.duration =CMTimeMakeWithSeconds(1, 1);
item2.time = CMTimeMakeWithSeconds(0, 1);
After reading I got the following:
AVMutableMetadataItem: 0xa4301f0, keySpace=itsk, key=\U00a9cmt, commonKey=(null), locale= (null), value=One two three, time={INVALID}, duration={INVALID}, extras={\n dataType = 1;\n}
I would like to use time & duration properties for metadata instead of writing custom data and processing it after that.
Ideally it would be great to append array of items with time = t1, duration = d1, .... (tn,dn).
Does anyone know how to accomplish that?
I've ended with a solution adding chapters to a video file instead of using metadata.
I looked at available libraries, took mpv4lib.
The library currently is not compiled for iOS, therefore, I ported the source project into static library for iOS platform.
That library allows to add custom "atoms" to mp4 file, and one of them is Quick Time text track, containing chapters.
I do similar with that post
The library is located here.
I'm making an app which records video. I'm saving the video to the app's sandbox, and hence I have no need to access the users photo library. I don't want my app to ask for permission ever. HOWEVER, about 50% of the time the app opens, it asks for permission to access photos.
My best guess at the cause: I am using a library which makes it easier to work with AV Foundation, and it has some feature buried in it's code which is triggering the permission dialog.
What's the best way to make sure the dialog never appears? Can I override it by setting a firm NO somewhere in my app's plist? Do I have to root through the library's code to find the offending feature? If so, what's the best way to identify the culprit? What's most likely to be triggering the dialog?
The libraries I'm using:
DIYAV: https://github.com/diy/av
DIYCam: https://github.com/thisandagain/cam
I'm triggering recording like this:
// self.cam is a DIYCam instance
[self.cam startSession];
[self.cam captureVideoStart];
and stopping recording like this:
[self.cam captureVideoStop];
[self.cam stopSession];
if you want to search the framework and you have the code, you should search for UIImagePickerControllerSourceTypePhotoLibrary or UIImagePickerControllerSourceTypeSavedPhotosAlbum
These are the ones, that access the iPhone photo library.
Setting the "DIYAVSettingSaveLibrary" to false seems to have solved it. (It's set to true by default.)
NSDictionary *options;
options = #{ DIYAVSettingFlash : #false,
DIYAVSettingOrientationForce : #false,
DIYAVSettingOrientationDefault : [NSNumber numberWithInt:AVCaptureVideoOrientationLandscapeRight],
DIYAVSettingCameraPosition : [NSNumber numberWithInt:AVCaptureDevicePositionBack],
DIYAVSettingCameraHighISO : #true,
DIYAVSettingPhotoPreset : AVCaptureSessionPresetPhoto,
DIYAVSettingPhotoGravity : AVLayerVideoGravityResizeAspectFill,
DIYAVSettingVideoPreset : AVCaptureSessionPreset1280x720,
DIYAVSettingVideoGravity : AVLayerVideoGravityResizeAspectFill,
DIYAVSettingVideoMaxDuration : #300,
DIYAVSettingVideoFPS : #30,
DIYAVSettingSaveLibrary : #false };
[cam setupWithOptions:options]; // Check DIYAV.h for options
[cam setCamMode:DIYAVModeVideo];
My understanding currently is that:
CameraUI
I can use the CameraUI to access the built in camera for MediaType.VIDEO and that delegates to the built-in video camera app and lets me record a video. My app does that now.
When I stop recording and click the "Use" button, I am returned to my app and theoretically I have a valid MediaPromise.
iOS does -not- provide a valid/usable url/filename to the recorded video (or to photos) and so I would have to use a Loader to bring-in/use/access the 'recorded' video... AND... iOS does not actually create a file anywhere on the device, most importantly, in the Camera Roll where one would expect by the normal behavior when uses the system native camera/video app.
The documentation says that the Loader can load various image types and SWFs but nothing about video data, so I conclude from that that I cannot actually use the CameraUI to generate a valid MediaPromise that I can then pass to a Loader class or similar to read in the information created by the system camera and then manipulate (upload, save to applicationStorageDirectory, and/or display in one of the two video player components available in the API).
CameraRoll
I can have video entities in the iOS Camera Roll but the AS3/Air3.5 CameraRoll class won't let me view/access/reference them in any way.
Normal File I/O
All my attempts to use the Air3.5 File classes to browse to the storage location of the iOS Camera Roll have been rebuffed.
------- Questions -------
Am I correct in believing that there is a way to take video but no way to use the video that's been captured. (No way to use the resulting MediaPromise successfully).
I believe you can take video and access it using Android, but there's nothing in the documentation that says that you cannot using iOS.
Am I correct in believing that iOS sandboxes apps so that they cannot browse to video/photo storage using standard File I/O, but only through the apparently non-workable means I've tried (CameraUI & CameraRoll)
Am I wrong to think that these should be rather obvious NEEDS that one can achieve using the XCode Objective C++ etc route but the AIR Mobile Framework does not allow either because of Apple blocking functionality or because Adobe has failed to meet reasonable expectations?
One item of ironic note to convey. If I use the iOS system camera app to record a video, a thumnail of that video then appears in the Gallery/Camera Roll, and of course, I can share it or view it, or whatever... If I use AIR's CameraRoll.browseForImage(), provided I haven't used the camera to take another image, when it shows me the folder where the pictures are stored, the folder icon uses the thumbnail of the last object added... in this case, the video I took, but if I then enter the folder, the video cannot be found. It's teasing us. It knows it's there, but it is apparently forbidden fruit.
I can't answer all your questions, so this entry may not be acceptable, but I found this page while searching a solution for some the problems you described and thought that someone else may find this answer (partially) useful.
To save the movie you just took you need to open and read the data from the promise.
The iOS won't save the file anywere, so the MediaPromise.file is always null.
This is my solution to the problem:
private var camera:CameraUI;
private var dataInput:IDataInput;
public function recordVideo():void
{
// Start the camera and ask for a video
camera = new CameraUI();
camera.addEventListener(MediaEvent.COMPLETE, onCameraComplete);
camera.launch(MediaType.VIDEO);
}
private function onCameraComplete(event:MediaEvent):void
{
// event.data is a MediaPromise and MediaPromise.open() returns a IDataInput
// Let's cast it to a dispatcher and check when it's complete
dataInput = event.data.open();
var dispatcher:IEventDispatcher = IEventDispatcher(dataInput);
dispatcher.addEventListener(Event.COMPLETE, onDataInputComplete);
}
private function onDataInputComplete(event:Event):void
{
// We can do whatever we want with the data, so we'll store it in a File
var file:File = new File();
var bytes:ByteArray = new ByteArray();
var stream:FileStream = new FileStream();
// Reading the data from the opened MediaPromise
dataInput.readBytes(bytes);
stream.open(file, FileMode.WRITE);
stream.writeBytes(bytes, 0, bytes.bytesAvailable);
stream.close();
}
Also, I'm still looking for a way to put the movie in the CameraRoll