Configure AVAssetCache to store AVURLAsset - avplayer

I'm trying to access property assetCache from AVURLAsset object, but it's always nil.
Documentation provides next information:
/*!
#property assetCache
#abstract Provides access to an instance of AVAssetCache to use for
inspection of locally cached media data. Will be nil if an asset has
not been configured to store or access media data from disk.
*/
#property (nonatomic, readonly, nullable) AVAssetCache *assetCache NS_AVAILABLE(10_12, 10_0);
So, how can I configure AVURLAsset to make it possible to store or access media data from disk?

Related

How to store content in a Hybris Media file?

In my application we are getting media like photos and Videos from third party and I want to store it in Hybris as a media ?
How can we upload Photos/Videos through the java code in a Hybris Media?
You can check my simple example. Not forget to add exception block. Check CatalogUnawareMedia and CatalogMedia before your implementation. If you are not planning to synchronize third-party objects use CatalogUnawareMedia.
// folder optional
final MediaFolderModel folder = mediaService.getFolder("myfolder");
final CatalogUnawareMediaModel media = getModelService().create(CatalogUnawareMediaModel.class); //or CatalogMediaModel
media.setCode(myFileName);
media.setFolder(folder);
getModelService().save(media);
mediaService.setStreamForMedia(media, myStream);
getModelService().save(media);

Redact sensitive information when using ServiceStack.Text to serialize to log files

I am using ServiceStack.Text and ServiceStack.Logging.NLog to log the DTO requests sent to/from a web service from a .NET client application. While the machines are generally secure, I'd like to redact sensitive information that might be stored in plain-text (think name, address, basic auth creds, etc.).
I've looked at the various JsConfig<T> methods, but it seems like I'd have to implement a SerializeFn<T> for every DTO. There is risk in "missing one", and I'd want to apply it only to the scope of logging.
I've looked at NLog filters, and when just changes whether the message is logged.
Is there some universal way to replace sensitive properties/keys/attributes with a redaction marker when logging DTOs with ServiceStack.Logging \ NLog?
There's no scoped serializer options that changes what fields should be serialized.
Possible solutions I'd be looking at would be maintaining a whitelist of DTO Types with sensitive info that should not be logged or using reflection to set properties you don't want to null.
ServiceStack has APIs for converting Types in an object dictionary and rehydrate types from Dictionaries so you could do something like:
var map = requestDto.ToObjectDictionary();
ProtectedNames.ForEach(x => map.Remove(x));
You can then either serialize the remaining properties in map or convert it back into the Request DTO without the removed properties:
var safeDto = map.FromObjectDictionary(requestDto.GetType());

FIWARE object storage GE: Different type of responses obtained when downloading an image object

I can effectively make use of all operations available for Object Storage on my FIWARE account.
Nonetheless I have identified a strange behaviour when downloading objects from a container.
Please find below the procedure to reproduce that strange behaviour:
I upload two objects ("gonzo.png" and "elmo.png") to the container "photos"
1.1. First, by means of cloud UI (https://cloud.lab.fiware.org/#objectstorage/containers/) I manually upload the object "gonzo.png"
1.2. Later, by following the instructions from Object Storage GE programmer's guide I programmatically (or with the help of standalone Rest Client) upload the object "elmo.png"
I download the objects from the container "photos"
2.1 First, by following the instructions from Object Storage GE programmer's guide I successfully download object "gonzo.png". The webservice response body is the binary content of such object.
2.2. Later, by following same instructions as in step 2.1 I try to download the object "elmo.png". Now the webservice response body is a json with metadata and the binary content of the object.
What can I do receive a standard response body for both objects? Either binary or either json.
Why do I get a different response if the object is originally uploaded via Cloud UI or via external tool (program or rest client) ?
As in Download blob from fiware object-storage I have already tried to set the header response_type: text and the behaviour is the same.
There are many object stores out there, having different APIs.
The Object Storage GE was initially based on the CDMI API [1].
Currently, it is based on Openstack Swift [2].
The Cloud Portal still uses some of the CDMI features and specifically it may do 64-bit encoding of some types of objects in which case the object content is a json which contains the metadata and a base64 encoding of the data. I suspect that this is what happened to the object you have created using the cloud UI.
Thus, please use Swift native API for all operations.
The API is well documented here: http://developer.openstack.org/api-ref-objectstorage-v1.html
and the python examples in the programmer guide (https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Object_Storage_-_User_and_Programmers_Guide) also use the Native API.
[1] google for SNIA CDMI. Having less then 10 replutation I cannot put too many links
[2] google for Openstack Swift

NSFetchedResultController not getting updated

I am using a UICollectionView to manage a to-do list with a NSFetchedResultController and RestKit. When I am creating/updating an element with the postObject:/putObject: methods, NSFetchedResultController does not get updated. If I call the reload method on the collection view new objects are not present. The only solution I found is reloading all the objects with getObjectsAtPath.
New objects are well added to the backend storage as well as in the local SQLite database. I set up the NSFetchedResultController's delegate correctly and initialized it with the mainQueueManagedObjectContext.

Getting an object's links in Rackspace cloud files API

I am using the Java jclouds API for access to my Rackspace cloud files account.
I can create and list containers, and upload objects, but I can't figure out how to get the public links for an uploaded object. (I can see these public links from within the Rackspace control panel, by right-clicking on the object - there are 4 types: HTTP, HTTPS, Streaming, iOS Streaming).
The closest I can get is by using object.getInfo() to get the object's metadata. This includes a URI, but this doesn't resemble the public links I find from within the control panel.
Anyone know what I'm doing wrong?
I figured it out...
First, I should get the public URI of the object's container, not from the object.
Then I use a CloudFilesClient object. On the container I need to use getCDNMetadata("containername").getCDNUri()
Here is more information and some sample code to get the specific file CDN address.
For more details you can checkout the Java guide:
https://developer.rackspace.com/docs/cloud-files/quickstart/?lang=java
First get the cloud files api:
CloudFilesApi cloudFilesApi = ContextBuilder.newBuilder("rackspace-cloudfiles-us")
.credentials("{username}", "{apiKey}")
.buildApi(CloudFilesApi.class);
From there you can query the container:
CDNApi cdnApi = cloudFilesApi.getCDNApi("{region}");
CDNContainer cdnContainer = cdnApi.get("{containerName}");
Now with that CDNContainer you can get the specific web address that you need:
URI httpURI = cdnContainer.getUri();
URI httpsURI = cdnContainer.getSslUri();
This will get you the base URI for the container. Now to get the final address for your specific file you will need to append /{"your_file_name.extension"} to the end of the address. For example if my base URI was converted to a URL then to a String it may look like:
http://123456asdf-qwert987653.rackcdn.com/
From here I can get a file with the name example.mp4 with the following address:
http://123456asdf-qwert987653.rackcdn.com/example.mp4
This all assumes that you have already enabled CDN on the container.

Resources