content api the content api provides functionality to discover content such as images, videos, music, or others it is possible to search for specific content using filters the api also supports setting the attributes of specific content for more information on the content features, see stored content management guide playlist functionality has been added in tizen 2 3 since 2 0 summary of interfaces and methods interface method contentmanagerobject contentmanager void update content content void updatebatch content[] contents, optional successcallback? successcallback, optional errorcallback? errorcallback void getdirectories contentdirectoryarraysuccesscallback successcallback, optional errorcallback? errorcallback void find contentarraysuccesscallback successcallback, optional errorcallback? errorcallback, optional contentdirectoryid? directoryid, optional abstractfilter? filter, optional sortmode? sortmode, optional unsigned long? count, optional unsigned long? offset void scanfile domstring contenturi, optional contentscansuccesscallback? successcallback, optional errorcallback? errorcallback void scandirectory domstring contentdiruri, boolean recursive, optional contentscansuccesscallback? successcallback, optional errorcallback? errorcallback void cancelscandirectory domstring contentdiruri long addchangelistener contentchangecallback changecallback void removechangelistener long listenerid void getplaylists playlistarraysuccesscallback successcallback, optional errorcallback? errorcallback void createplaylist domstring name, playlistsuccesscallback successcallback, optional errorcallback? errorcallback, optional playlist? sourceplaylist void removeplaylist playlistid id, optional successcallback? successcallback, optional errorcallback? errorcallback void createthumbnail content content, thumbnailsuccesscallback successcallback, optional errorcallback? errorcallback contentarraysuccesscallback void onsuccess content[] contents contentdirectoryarraysuccesscallback void onsuccess contentdirectory[] directories contentscansuccesscallback void onsuccess domstring uri contentchangecallback void oncontentadded content content void oncontentupdated content content void oncontentremoved contentid id void oncontentdiradded contentdirectory contentdir void oncontentdirupdated contentdirectory contentdir void oncontentdirremoved contentdirectoryid id contentdirectory content videocontent audiocontentlyrics audiocontent imagecontent playlistitem playlist void add content item void addbatch content[] items, optional successcallback? successcallback, optional errorcallback? errorcallback void remove playlistitem item void removebatch playlistitem[] items, optional successcallback? successcallback, optional errorcallback? errorcallback void get playlistitemarraysuccesscallback successcallback, optional errorcallback? errorcallback, optional long? count, optional long? offset void setorder playlistitem[] items, optional successcallback? successcallback, optional errorcallback? errorcallback void move playlistitem item, long delta, optional successcallback? successcallback, optional errorcallback? errorcallback playlistarraysuccesscallback void onsuccess playlist[] playlists playlistsuccesscallback void onsuccess playlist playlist playlistitemarraysuccesscallback void onsuccess playlistitem[] items thumbnailsuccesscallback void onsuccess domstring path 1 type definitions 1 1 contentdirectorystoragetype enum contentdirectorystoragetype { "internal", "external" } since 2 0 defines whether a content directory is stored on internal or external storage such as a removable memory card 1 2 contenttype enum contenttype { "image", "video", "audio", "other" }; since 2 0 defines the type of content such as an image, video, audio, or any other remark "other" type is added since tizen 2 1 and since 4 0 it is optional type, related to http //tizen org/feature/content scanning others feature one can check "other" type support using systeminfo api with tizen systeminfo getcapability "http //tizen org/feature/content scanning others" 1 3 audiocontentlyricstype enum audiocontentlyricstype { "synchronized", "unsynchronized" }; since 2 0 defines whether the lyrics supplied with an audio file is time-synchronized 1 4 imagecontentorientation enum imagecontentorientation { "normal", "flip_horizontal", "rotate_180", "flip_vertical", "transpose", "rotate_90", "transverse", "rotate_270" }; since 2 0 defines the orientation of an image 1 5 contentid content identifier typedef domstring contentid; since 2 0 1 6 contentdirectoryid content directory identifier typedef domstring contentdirectoryid; since 2 0 1 7 playlistid playlist identifier typedef domstring playlistid; since 2 3 2 interfaces 2 1 contentmanagerobject defines what is instantiated by the tizen object [nointerfaceobject] interface contentmanagerobject { readonly attribute contentmanager content; }; tizen implements contentmanagerobject; since 2 0 the tizen content object allows accessing the functionality of the content module 2 2 contentmanager the contentmanager interface provides operations to retrieve and manipulate content [nointerfaceobject] interface contentmanager { void update content content raises webapiexception ; void updatebatch content[] contents, optional successcallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void getdirectories contentdirectoryarraysuccesscallback successcallback, optional errorcallback? errorcallback raises webapiexception ; void find contentarraysuccesscallback successcallback, optional errorcallback? errorcallback, optional contentdirectoryid? directoryid, optional abstractfilter? filter, optional sortmode? sortmode, optional unsigned long? count, optional unsigned long? offset raises webapiexception ; void scanfile domstring contenturi, optional contentscansuccesscallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void scandirectory domstring contentdiruri, boolean recursive, optional contentscansuccesscallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void cancelscandirectory domstring contentdiruri raises webapiexception ; long addchangelistener contentchangecallback changecallback raises webapiexception ; void removechangelistener long listenerid raises webapiexception ; void getplaylists playlistarraysuccesscallback successcallback, optional errorcallback? errorcallback raises webapiexception ; void createplaylist domstring name, playlistsuccesscallback successcallback, optional errorcallback? errorcallback, optional playlist? sourceplaylist raises webapiexception ; void removeplaylist playlistid id, optional successcallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void createthumbnail content content, thumbnailsuccesscallback successcallback, optional errorcallback? errorcallback raises webapiexception ; }; since 2 0 methods update updates attributes of content in the content database synchronously void update content content ; since 2 0 when an application has changed some attributes of the content, this method allows writing it back to the content database privilege level public privilege http //tizen org/privilege/content write remark the editableattributes in the content interface indicates the attributes that can be changed this api does not support updating the metadata of a file parameters content the content to update exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type invalidvalueserror, if any of the input parameters contain an invalid value with error type securityerror, if the application does not have the privilege to call this method with error type unknownerror, in any other error case code example // assume the content is a content object as a result of find method // check the description is editable, and then set a description if content editableattributes indexof "description" >= 0 { content description = "sample content"; } tizen content update content ; updatebatch updates a batch of content attributes in the content database asynchronously void updatebatch content[] contents, optional successcallback? successcallback, optional errorcallback? errorcallback ; since 2 0 when an application has changed any attributes in the array of content, this method allows writing them back to the content database the errorcallback is launched with these error types invalidvalueserror if any of the input parameters contain an invalid value unknownerror in any other error case privilege level public privilege http //tizen org/privilege/content write remark the editableattributes in the content interface indicates the attributes that can be changed this api does not support updating the metadata of a file parameters contents array of content to change successcallback [optional] [nullable] callback method to be invoked when attributes have been changed errorcallback [optional] [nullable] callback method to be invoked when an error has occurred exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method code example // the following example increases rating of an content by 1 function errorcb err { console log 'the following error occurred ' + err name ; } function successcb { console log 'attributes set successfully' ; } // assume the content is a content object as a result of find method // check the rating is editable, and then increase by 1 if content editableattributes indexof "rating" >= 0 { content rating++; } tizen content updatebatch [content], successcb, errorcb ; getdirectories gets a list of content directories getdirectories contentdirectoryarraysuccesscallback successcallback, optional errorcallback? errorcallback ; since 2 0 this method returns via callback a list of content directory objects to obtain a list of contents in a specific directory, use the find method with the directory id the errorcallback is launched with this error type unknownerror in any other error case parameters successcallback callback method to be invoked when content directories have been retrieved successfully errorcallback [optional] [nullable] callback method to be invoked when an error has occurred exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type for that parameter code example // the following example retrieves content directories in the storage function errorcb err { console log 'the following error occurred ' + err name ; } function printdirectory directory, index, directories { console log 'directoryuri ' + directory directoryuri + ' title ' + directory title ; } function getdirectoriescb directories { directories foreach printdirectory ; } tizen content getdirectories getdirectoriescb, errorcb ; find finds contents that satisfy the conditions set by a filter find contentarraysuccesscallback successcallback, optional errorcallback? errorcallback, optional contentdirectoryid? directoryid, optional abstractfilter? filter, optional sortmode? sortmode, optional unsigned long? count, optional unsigned long? offset ; since 2 0 this method allows searching based on a supplied filter for more details on abstractfilter, see the tizen module the filter allows precise searching such as "return all songs by artist u2, ordered by name" the errorcallback is launched with these error types invalidvalueserror if any of the input parameters contain an invalid value unknownerror in any other error case privilege level public privilege http //tizen org/privilege/content read parameters successcallback callback method to be invoked when content has been retrieved errorcallback [optional] [nullable] callback method to be invoked when an error has occurred directoryid [optional] [nullable] directory id that is used to select content to retrieve in a specified directory filter [optional] [nullable] filter that is used to select content to retrieve sortmode [optional] [nullable] used to determine the sort order in which the contents are returned count [optional] [nullable] maximum amount of content to return if count is negative, invalidvalueserror is reported through the errorcallback offset [optional] [nullable] offset of the result set if offset is a negative number, invalidvalueserror is reported through the errorcallback exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method code example // the following example retrieves all songs from the album "the joshua tree", by artist "u2", ordered by the name var count = 100; var offset = 0; var sortmode = new tizen sortmode "name", "asc" ; var artistfilter = new tizen attributefilter "artists", "exactly", "u2" ; var albumfilter = new tizen attributefilter "album", "exactly", "the joshua tree" ; var filter = new tizen compositefilter "intersection", [albumfilter, artistfilter] ; function errorcb err { console log 'the following error occurred ' + err name ; } function printcontent content, index, contents { console log 'name ' + content name + ' title ' + content title + 'url ' + content contenturi + 'mime ' + content mimetype ; } function findcb contents { console log 'the joshua tree by u2 ' ; contents foreach printcontent ; // increase the offset as much as the count and then find content again if contents length === count { offset += count; tizen content find findcb, errorcb, null, filter, sortmode, count, offset ; } } tizen content find findcb, errorcb, null, filter, sortmode, count, offset ; scanfile scans a file to create or update content in the content database void scanfile domstring contenturi, optional contentscansuccesscallback? successcallback, optional errorcallback? errorcallback ; since 2 1 when an application creates or updates content, this method allows to scan it and then insert or update the content in the content database the errorcallback is launched with these error types unknownerror in case of any error detected asynchronously notsupportederror in case of trying to scan content of not supported type since 4 0 privilege level public privilege http //tizen org/privilege/content write parameters contenturi uri of content to scan successcallback [optional] [nullable] callback method to be invoked when scanning has been completed errorcallback [optional] [nullable] callback method to be invoked when an error has occurred exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type invalidvalueserror, if any of the input parameters contain an invalid value e g given contenturi is an empty string with error type securityerror, if the application does not have the privilege to call this method code example // the following example scan 'tizen jpg' in media directory function errorcb err { console log 'the following error occurred ' + err name ; } function successcb path { console log 'scanning is completed' ; } tizen filesystem resolve "images/tizen jpg", function imagefile { tizen content scanfile imagefile touri , successcb, errorcb ; } ; scandirectory scans a content directory to create or update content in the content database void scandirectory domstring contentdiruri, boolean recursive, optional contentscansuccesscallback? successcallback, optional errorcallback? errorcallback ; since 2 4 when an application creates or updates content in a directory, this method allows to scan it and then insert or update the content in the content database if a directory must not be scanned, the file scan_ignore has to be created in it the errorcallback is launched with these error types unknownerror in case of any error detected asynchronously privilege level public privilege http //tizen org/privilege/content write parameters contentdiruri uri of a content directory to scan recursive used to determine whether the function makes recursive scan or not if set to true, the function makes recursive scan successcallback [optional] [nullable] callback method to be invoked when scanning has been completed errorcallback [optional] [nullable] callback method to be invoked when an error has occurred exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type invalidvalueserror, if any of the input parameters contain an invalid value e g given contentdiruri is an empty string with error type securityerror, if the application does not have the privilege to call this method with error type unknownerror, if any other error occurs code example // the following example scans 'images' directory function errorcb err { console log 'the following error occurred ' + err name ; } function successcb path { console log 'scanning is completed' ; } tizen filesystem resolve "images", function directory { tizen content scandirectory directory touri , true, successcb, errorcb ; } ; cancelscandirectory cancels a scan process of a content directory void cancelscandirectory domstring contentdiruri ; since 2 4 when a scan of a given directory is running it may be canceled by this function privilege level public privilege http //tizen org/privilege/content write parameters contentdiruri uri of a content directory with a scan process running which is canceled exceptions webapiexception with error type invalidvalueserror, if any of the input parameters contain an invalid value e g given contentdiruri is an empty string with error type securityerror, if the application does not have the privilege to call this method with error type unknownerror, if any other error occurs code example tizen content cancelscandirectory directory touri ; addchangelistener adds a listener which receives notifications when content changes long addchangelistener contentchangecallback changecallback ; since 3 0 parameters changecallback callback to be invoked when a content change is detected return value long identifier of the newly added listener exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type aborterror, if the operation cannot be finished properly code example var listener = { oncontentadded function content { console log content contenturi + ' content is added' ; }, oncontentupdated function content { console log content contenturi + ' content is updated' ; }, oncontentremoved function id { console log id + ' is removed' ; }, oncontentdiradded function contentdir { console log contentdir directoryuri + ' content directory is added' ; }, oncontentdirupdated function contentdir { console log contentdir directoryuri + ' content directory is updated' ; }, oncontentdirremoved function id { console log id + ' directory is removed' ; } }; // adds the listener var listenerid = tizen content addchangelistener listener ; console log 'listener id ' + listenerid ; output example listener id 1 removechangelistener removes a listener which receives notifications about content changes void removechangelistener long listenerid ; since 3 0 parameters listenerid identifier of the listener to be removed it is returned by addchangelistener when a listener is successfully added exceptions webapiexception with error type aborterror, if the operation cannot be finished properly code example var listener = { oncontentadded function content { console log content contenturi + ' content is added' ; }, oncontentupdated function content { console log content contenturi + ' content is updated' ; }, oncontentremoved function id { console log id + ' is removed' ; }, oncontentdiradded function contentdir { console log contentdir directoryuri + ' content directory is added' ; }, oncontentdirupdated function contentdir { console log contentdir directoryuri + ' content directory is updated' ; }, oncontentdirremoved function id { console log id + ' directory is removed' ; } }; var listenerid = tizen content addchangelistener listener ; // do some job here and when the listener is not needed anymore remove it // removes the listener tizen content removechangelistener listenerid ; setchangelistener sets a listener to receive notifications of content changes deprecated deprecated since 3 0 instead, addchangelistener allows application developers to add a listener and get notified when content is added, removed or updated on a device void setchangelistener contentchangecallback changecallback ; since 2 1 privilege level public privilege http //tizen org/privilege/content read parameters changecallback a callback to be invoked for receiving a content change notification exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type invalidvalueserror, if any of the input parameters contain an invalid value with error type securityerror, if the application does not have the privilege to call this method with error type unknownerror, if any other error occurs code example var listener= { oncontentadded function content { console log content contenturi + ' content is added' ; }, oncontentupdated function content { console log content contenturi + ' content is updated' ; }, oncontentremoved function id { console log id + ' is removed' ; }, oncontentdiradded function contentdir { console log contentdir directoryuri + ' content directory is added' ; }, oncontentdirupdated function contentdir { console log contentdir directoryuri + ' content directory is updated' ; }, oncontentdirremoved function id { console log id + ' directory is removed' ; } }; // registers to be notified when the content changes tizen content setchangelistener listener ; unsetchangelistener unsets the listener to unsubscribe from receiving notifications for content changes deprecated deprecated since 3 0 instead, use removechangelistener void unsetchangelistener ; since 2 1 privilege level public privilege http //tizen org/privilege/content read exceptions webapiexception with error type securityerror, if the application does not have the privilege to call this method with error type unknownerror, if any other error occurs code example tizen content unsetchangelistener ; getplaylists gets all playlists void getplaylists playlistarraysuccesscallback successcallback, optional errorcallback? errorcallback ; since 2 3 the errorcallback is launched with these error types unknownerror in case of any error privilege level public privilege http //tizen org/privilege/content read parameters successcallback callback method to be invoked when retrieving a list of all playlists completes errorcallback [optional] [nullable] callback method to be invoked when an error occurs exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method code example var gplaylists; function getplaylistsfail err { console log "getplaylists failed " + err ; } function getplaylistssuccess playlists { var cur, i; gplaylists = playlists; for i = 0; i < gplaylists length; ++i { cur = gplaylists[i]; console log "[" + i + "] name " + cur name + " num tracks " + cur numberoftracks ; } } tizen content getplaylists getplaylistssuccess, getplaylistsfail ; createplaylist creates a new playlist void createplaylist domstring name, playlistsuccesscallback successcallback, optional errorcallback? errorcallback, optional playlist? sourceplaylist ; since 2 3 the errorcallback is launched with these error types invalidvalueserror if name is empty or is same as the name of an existing playlist unknownerror in case of any other error privilege level public privilege http //tizen org/privilege/content write parameters name name of the new playlist case sensitive successcallback callback method to be invoked to provide a created playlist errorcallback [optional] [nullable] callback method to be invoked when an error occurs sourceplaylist [optional] [nullable] optional existing playlist to clone exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method code example var gplaylists; var gplaylist; function getplaylistsfail err { console log "getplaylists failed " + err message ; } function getplaylistssuccess playlists { var cur, i; gplaylists = playlists; for i = 0; i < gplaylists length; ++i { cur = gplaylists[i]; console log "[" + i + "] name " + cur name + " num tracks " + cur numberoftracks ; } } function findsuccess contents { if contents length > 0 { gplaylist add contents[0] ; } tizen content getplaylists getplaylistssuccess, getplaylistsfail ; } function findfail err { console log "find fail " + err message ; } function createsuccess playlist { console log "create success" ; gplaylist = playlist; tizen content find findsuccess, findfail, null, new tizen attributefilter "type", "exactly", "audio" ; } function createfail err { console log "create fail " + err message ; } tizen content createplaylist "my new playlist", createsuccess, createfail ; removeplaylist removes a playlist void removeplaylist playlistid id, optional successcallback? successcallback, optional errorcallback? errorcallback ; since 2 3 the errorcallback is launched with these error types unknownerror in case of any error privilege level public privilege http //tizen org/privilege/content write parameters id identifier of a playlist to remove successcallback [optional] [nullable] callback method to be invoked when removing a playlist completes errorcallback [optional] [nullable] callback method to be invoked when an error occurs exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method code example var gplaylists; function removeplaylistsuccess { console log "removeplaylist success" ; } function removeplaylistfail err { console log "removeplaylist fail " + err ; } function getplaylistsfail err { console log "getplaylists failed " + err ; } function getplaylistssuccess playlists { var cur, i; gplaylists = playlists; for i = 0; i < gplaylists length; ++i { cur = gplaylists[i]; console log "[" + i + "] name " + cur name + " num tracks " + cur numberoftracks ; } if gplaylists length < 1 { console log "please add at least 1 playlist" ; return; } console log "will remove playlist at index [0] name " + gplaylists[0] name ; tizen content removeplaylist gplaylists[0] id, removeplaylistsuccess, removeplaylistfail ; } tizen content getplaylists getplaylistssuccess, getplaylistsfail ; createthumbnail creates a content's thumbnail void createthumbnail content content, thumbnailsuccesscallback successcallback, optional errorcallback? errorcallback ; since 3 0 the errorcallback is launched with these error types invalidvalueserror in case of invalid content object aborterror in case of any error privilege level public privilege http //tizen org/privilege/content write parameters content content object for which a new thumbnail will be created successcallback callback method to be invoked when the thumbnail is created errorcallback [optional] [nullable] callback method to be invoked when an error occurs exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method code example function createcb path { console log "the thumbnail path is " + path ; } function findcb contents { if contents length > 0 { tizen content createthumbnail contents[0], createcb ; } } tizen content find findcb ; output example the thumbnail path is /home/owner/share/media/ thumb/phone/ jpg-bed1d5f494830f7a52e1217f1e924aff jpg 2 3 contentarraysuccesscallback the callback function used to return a list of content objects [callback=functiononly, nointerfaceobject] interface contentarraysuccesscallback { void onsuccess content[] contents ; }; since 2 0 methods onsuccess called when the list of content is retrieved successfully void onsuccess content[] contents ; since 2 0 parameters contents the array of content objects 2 4 contentdirectoryarraysuccesscallback the callback function used to return a list of contentdirectory objects [callback=functiononly, nointerfaceobject] interface contentdirectoryarraysuccesscallback { void onsuccess contentdirectory[] directories ; }; since 2 0 methods onsuccess called when the directory list is retrieved successfully void onsuccess contentdirectory[] directories ; since 2 0 parameters directories the array of contentdirectory objects 2 5 contentscansuccesscallback the callback function used to return content or content directory to scan [callback=functiononly, nointerfaceobject] interface contentscansuccesscallback { void onsuccess domstring uri ; }; since 2 1 methods onsuccess called when the scanning has been completed void onsuccess domstring uri ; since 2 1 remark this callback is also invoked upon success of the scandirectory method since tizen 2 4 therefore, the uri parameter may now also be the uri of a contentdirectory object parameters uri the uri of the content or the contentdirectory object 2 6 contentchangecallback this interface specifies a set of methods that are invoked every time a content change occurs [callback, nointerfaceobject] interface contentchangecallback { void oncontentadded content content ; void oncontentupdated content content ; void oncontentremoved contentid id ; void oncontentdiradded contentdirectory contentdir ; void oncontentdirupdated contentdirectory contentdir ; void oncontentdirremoved contentdirectoryid id ; }; since 2 1 methods oncontentadded called when content is added void oncontentadded content content ; since 2 1 parameters content the content to add oncontentupdated called when content is updated void oncontentupdated content content ; since 2 1 parameters content the content to update oncontentremoved called when content is removed void oncontentremoved contentid id ; since 2 1 parameters id the id of removed content oncontentdiradded called when a content directory is added void oncontentdiradded contentdirectory contentdir ; since 2 4 parameters contentdir the added content directory oncontentdirupdated called when a content directory is updated void oncontentdirupdated contentdirectory contentdir ; since 2 4 parameters contentdir the content directory?after the update operation oncontentdirremoved called when a content directory is removed void oncontentdirremoved contentdirectoryid id ; since 2 4 parameters id the id of removed content directory 2 7 contentdirectory the contentdirectory interface provides access to properties of a content directory [nointerfaceobject] interface contentdirectory { readonly attribute contentdirectoryid id; readonly attribute domstring directoryuri; readonly attribute domstring title; readonly attribute contentdirectorystoragetype storagetype; readonly attribute date? modifieddate; }; since 2 0 attributes readonly contentdirectoryid id the opaque content directory identifier since 2 0 readonly smartcontrollermanager directoryuri the directory path on the device since 2 0 readonly smartcontrollermanager title the directory name since 2 0 readonly contentdirectorystoragetype storagetype the type of device storage since 2 0 readonly date modifieddate nullable the last modified date for a directory since 2 0 2 8 content the content interface provides access to the properties of a content item [nointerfaceobject] interface content { readonly attribute domstring[] editableattributes; readonly attribute contentid id; attribute domstring name; readonly attribute contenttype type; readonly attribute domstring mimetype; readonly attribute domstring title; readonly attribute domstring contenturi; readonly attribute domstring[]? thumbnailuris; readonly attribute date? releasedate; readonly attribute date? modifieddate; readonly attribute unsigned long size; attribute domstring? description; attribute unsigned long rating; attribute boolean isfavorite; }; since 2 0 attributes readonly smartcontrollermanager editableattributes the list of attributes that are editable to the local backend using the update or updatebatch method since 2 0 readonly contentid id the opaque content identifier since 2 0 domstring name the content name the initial value is the file name of the content since 2 1 readonly contenttype type the content type since 2 0 readonly smartcontrollermanager mimetype the content mime type since 2 0 readonly smartcontrollermanager title the content title since 2 0 readonly smartcontrollermanager contenturi the uri to access the content since 2 0 readonly smartcontrollermanager thumbnailuris thumbnailuris nullable the array of content thumbnail uris since 2 0 readonly date releasedate nullable the date when content has been released publicly if only the release year is known, then the month and date are set to january and 1st respectively since 2 0 readonly date modifieddate nullable the last modified date for a content item since 2 0 readonly unsigned long size the file size of the content in bytes since 2 0 domstring description nullable the content description since 2 0 unsigned long rating the content rating this value can range from 0 to 10 since 2 0 boolean isfavorite boolean value that indicates whether a content item is marked as a favorite since 2 3 2 9 videocontent the videocontent interface extends a basic content object with video-specific attributes [nointerfaceobject] interface videocontent content { attribute simplecoordinates? geolocation; readonly attribute domstring? album; readonly attribute domstring[]? artists; readonly attribute unsigned long duration; readonly attribute unsigned long width; readonly attribute unsigned long height; }; since 2 0 attributes simplecoordinates geolocation nullable the geographical location where the video has been made since 2 0 readonly smartcontrollermanager album nullable the album name to which the video belongs since 2 0 readonly smartcontrollermanager artists nullable the list of artists who created the video since 2 0 readonly unsigned long duration the video duration in milliseconds since 2 0 readonly unsigned long width the width of a video in pixels since 2 0 readonly unsigned long height the height of the video in pixels since 2 0 2 10 audiocontentlyrics the audiocontentlyrics interface provides lyrics for music [nointerfaceobject] interface audiocontentlyrics { readonly attribute audiocontentlyricstype type; readonly attribute unsigned long[] timestamps; readonly attribute domstring[] texts; }; since 2 0 attributes readonly audiocontentlyricstype type the type of lyrics, that is, whether they are synchronized with the music since 2 0 readonly unsigned unsigned long timestamps the array of timestamps in milliseconds for lyrics if the lyrics are not synchronized if there is no time information for the lyrics the array is undefined since 2 0 readonly smartcontrollermanager texts the array of lyrics snippets if the lyrics are not synchronized, the array has only one member with full lyrics since 2 0 2 11 audiocontent the audiocontent interface extends a basic content object with audio-specific attributes [nointerfaceobject] interface audiocontent content { readonly attribute domstring? album; readonly attribute domstring[]? genres; readonly attribute domstring[]? artists; readonly attribute domstring[]? composers; readonly attribute audiocontentlyrics? lyrics; readonly attribute domstring? copyright; readonly attribute unsigned long bitrate; readonly attribute unsigned short? tracknumber; readonly attribute unsigned long duration; }; since 2 0 attributes readonly smartcontrollermanager album nullable the album name to which the audio belongs since 2 0 readonly smartcontrollermanager genres nullable the list of genres to which the audio belongs since 2 0 readonly smartcontrollermanager artists nullable the list of artists who created the audio since 2 0 readonly smartcontrollermanager composers nullable the list of composers for the music since 2 0 readonly audiocontentlyrics lyrics nullable the lyrics of a song in an audio file since 2 0 readonly smartcontrollermanager copyright nullable the copyright information since 2 0 readonly unsigned long bitrate the audio bitrate in bits per second by default, this value is 0 since 2 0 readonly unsigned short tracknumber nullable the track number if the audio belongs to an album since 2 0 readonly unsigned long duration the audio duration in milliseconds since 2 0 2 12 imagecontent the imagecontent interface extends a basic content object with image-specific attributes [nointerfaceobject] interface imagecontent content { attribute simplecoordinates? geolocation; readonly attribute unsigned long width; readonly attribute unsigned long height; attribute imagecontentorientation orientation; }; since 2 0 attributes simplecoordinates geolocation nullable the geographical location where the image has been made since 2 0 readonly unsigned long width the width of an image in pixels since 2 0 readonly unsigned long height the height of an image in pixels since 2 0 imagecontentorientation orientation the image orientation since 2 0 2 13 playlistitem the playlistitem interface represents a playlist item [nointerfaceobject] interface playlistitem { readonly attribute content content; }; since 2 3 attributes readonly content content content contained in this playlist item since 2 3 2 14 playlist the playlist interface represents a playlist [nointerfaceobject] interface playlist { readonly attribute playlistid id; attribute domstring name raises webapiexception ; readonly attribute long numberoftracks; attribute domstring? thumbnailuri raises webapiexception ; void add content item raises webapiexception ; void addbatch content[] items, optional successcallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void remove playlistitem item raises webapiexception ; void removebatch playlistitem[] items, optional successcallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void get playlistitemarraysuccesscallback successcallback, optional errorcallback? errorcallback, optional long? count, optional long? offset raises webapiexception ; void setorder playlistitem[] items, optional successcallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void move playlistitem item, long delta, optional successcallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; }; since 2 3 attributes readonly playlistid id identifier of a playlist since 2 3 domstring name name of a playlist case sensitive and unique when name is set, the change is recorded in the database since 2 3 privilege level public privilege http //tizen org/privilege/content write exceptions webapiexception with error type invalidvalueserror, when assigning an invalid value e g playlist of the same name already exists with error type securityerror, if the application does not have the privilege to change this attribute readonly long numberoftracks number of playlist items in the playlist since 2 3 domstring thumbnailuri nullable thumbnail uri of a playlist by default, this attribute is set to null when thumbnailuri is set, the change is recorded in the database since 2 3 privilege level public privilege http //tizen org/privilege/content write exceptions webapiexception with error type invalidvalueserror, when assigning an invalid value e g if the uri does not start with "file ///" with error type securityerror, if the application does not have the privilege to change this attribute methods add adds a content item to a playlist void add content item ; since 2 3 see code example for the createplaylist method privilege level public privilege http //tizen org/privilege/content write parameters item content to add exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method with error type unknownerror, if any other error occurs addbatch adds tracks to a playlist as a batch, asynchronously void addbatch content[] items, optional successcallback? successcallback, optional errorcallback? errorcallback ; since 2 3 the errorcallback is launched with these error types unknownerror in case of any error privilege level public privilege http //tizen org/privilege/content write parameters items list of tracks content objects to add successcallback [optional] [nullable] callback method to be invoked when adding a list of content items to a playlist completes successfully errorcallback [optional] [nullable] callback method to be invoked when an error occurs exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method remove removes a track from a playlist void remove playlistitem item ; since 2 3 privilege level public privilege http //tizen org/privilege/content write parameters item playlist item to remove exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method with error type unknownerror, if any other error occurs code example var gplaylists, gitems, gcurplaylist; function get2fail err { console log "get items after remove failed " + err ; } function get2success items { console log "playlist items " ; for var i = 0; i < items length ; ++i { console log "[" + i + "] name " + items[i] content name ; } } function getsuccess items { gitems = items; if gitems length < 1 { console log "please add at least 1 tracks to playlist!" ; return; } console log "original playlist " ; for var i = 0; i < gitems length ; ++i { console log "[" + i + "] name " + gitems[i] content name ; } console log "will remove item at index [0] name " + gitems[0] content name ; gcurplaylist remove gitems[0] ; gcurplaylist get get2success, get2fail ; } function getfail err { console log "get items failed " + err ; } function getplaylistsfail err { console log "getplaylists failed " + err ; } function getplaylistssuccess playlists { gplaylists = playlists; if gplaylists length === 0 { console log "please create at least 1 playlist!" ; return; } gcurplaylist = gplaylists[0]; gcurplaylist get getsuccess, getfail ; } tizen content getplaylists getplaylistssuccess, getplaylistsfail ; removebatch removes tracks from a playlist as a batch, asynchronously void removebatch playlistitem[] items, optional successcallback? successcallback, optional errorcallback? errorcallback ; since 2 3 the errorcallback is launched with these error types unknownerror in case of any other error privilege level public privilege http //tizen org/privilege/content write parameters items list of tracks to remove successcallback [optional] [nullable] callback method to be invoked when removing a list of content items from a playlist completes successfully errorcallback [optional] [nullable] callback method to be invoked when an error occurs exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method code example var gplaylists, gitems, gcurplaylist; function get2fail err { console log "get items after remove batch failed " + err ; } function get2success items { console log "playlist after remove batch " ; for var i = 0; i < items length ; ++i { console log "[" + i + "] name " + items[i] content name ; } } function removebatchsuccess { console log "removebatch success" ; gcurplaylist get get2success, get2fail ; } function removebatchfail err { console log "removebatch failed " + err ; } function getsuccess items { gitems = items; if gitems length < 4 { console log "please add at least 4 tracks to playlist!" ; return; } console log "original playlist " ; for var i = 0; i < gitems length ; ++i { console log "[" + i + "] name " + gitems[i] content name ; } console log "will remove items at index [0] name " + gitems[0] content name + " and at index [2] name " + gitems[2] content name + " " ; gcurplaylist removebatch [gitems[2], gitems[0]], removebatchsuccess, removebatchfail ; } function getfail err { console log "get items failed " + err ; } function getplaylistsfail err { console log "getplaylists failed " + err ; } function getplaylistssuccess playlists { gplaylists = playlists; if gplaylists length === 0 { console log "please create at least 1 playlist!" ; return; } gcurplaylist = gplaylists[0]; gcurplaylist get getsuccess, getfail ; } tizen content getplaylists getplaylistssuccess, getplaylistsfail ; get gets playlist items from a playlist void get playlistitemarraysuccesscallback successcallback, optional errorcallback? errorcallback, optional long? count, optional long? offset ; since 2 3 the errorcallback is launched with these error types invalidvalueserror if any of the input parameters contain an invalid value e g count or offset is a negative number unknownerror in case of any error privilege level public privilege http //tizen org/privilege/content read parameters successcallback callback method to be invoked for a list of tracks in the playlist errorcallback [optional] [nullable] callback method to be invoked when an error occurs count [optional] [nullable] number of playlist items to return if the count is not passed, all playlist items are retrieved offset [optional] [nullable] offset of the track from the beginning of the playlist the default value is 0 it means no offset exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method code example var gplaylists, gitems, gcurplaylist; function getsuccess items { gitems = items; console log "playlist items " ; for var i = 0; i < items length ; ++i { console log "[" + i + "] name " + items[i] name ; } } function getfail err { console log "get items failed " + err ; } function getplaylistsfail err { console log "getplaylists failed " + err ; } function getplaylistssuccess playlists { gplaylists = playlists; if gplaylists length === 0 { console log "please create at least 1 playlist!" ; return; } gcurplaylist = gplaylists[0]; // to retrieves all playlist items of 'gcurplaylist' playlist gcurplaylist get getsuccess, getfail ; } tizen content getplaylists getplaylistssuccess, getplaylistsfail ; setorder changes the play order of all playlist items in the playlist void setorder playlistitem[] items, optional successcallback? successcallback, optional errorcallback? errorcallback ; since 2 3 the errorcallback is launched with these error types invalidvalueserror in case the item in the passed items array is not inside this playlist, or the items array does not contain all items from the playlist unknownerror in case of any other error privilege level public privilege http //tizen org/privilege/content write parameters items list of playlist items to set in play order this list must include all playlist items of this playlist if not, invalidvalueserror is thrown successcallback [optional] [nullable] callback method to be invoked when changing the positions of items in the playlist is successfully completed errorcallback [optional] [nullable] callback method to be invoked when an error occurs exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method code example var gplaylists, gitems, gcurplaylist, gexpectedorder; function get2fail err { console log "get items after set order failed " + err ; } function get2success items { console log "playlist order after setorder " ; for var i = 0; i < items length ; ++i { console log "[" + i + "] name " + items[i] content name ; } } function setordersuccess { console log "set items order success" ; gcurplaylist get get2success, get2fail ; } function setorderfail err { console log "set items order failed " + err ; } function getsuccess items { gitems = items; if gitems length < 2 { console log "please add at least 2 tracks to playlist!" ; return; } console log "original order " ; for var i = 0; i < gitems length ; ++i { console log "[" + i + "] name " + gitems[i] content name ; } gexpectedorder = gitems slice 0 ; gexpectedorder reverse ; console log "new order " ; for var i = 0; i < gexpectedorder length ; ++i { console log "[" + i + "] name " + gexpectedorder[i] content name ; } gcurplaylist setorder gexpectedorder, setordersuccess, setorderfail ; } function getfail err { console log "get items failed " + err ; } function getplaylistsfail err { console log "getplaylists failed " + err ; } function getplaylistssuccess playlists { gplaylists = playlists; if gplaylists length === 0 { console log "please create at least 1 playlist!" ; return; } gcurplaylist = gplaylists[0]; gcurplaylist get getsuccess, getfail ; } tizen content getplaylists getplaylistssuccess, getplaylistsfail ; move moves the specified item up or down a specified amount in the play order move playlistitem item, long delta, optional successcallback? successcallback, optional errorcallback? errorcallback ; since 2 3 if current index + delta is < 0 then the item is moved to the first position in the playlist ??number of tracks then the item is moved to the last position in the playlist the errorcallback is launched with these error types invalidvalueserror in case the item in the passed items array is not inside this playlist or some item of this playlist is not included in items unknownerror in case of any other error privilege level public privilege http //tizen org/privilege/content write parameters item playlist item to move delta how many positions to move the item, negative value means move up, positive means move down successcallback [optional] [nullable] callback method to be invoked when the playlist item has successfully been moved errorcallback [optional] [nullable] callback method to be invoked when an error occurs exceptions webapiexception with error type typemismatcherror, if any input parameter is not compatible with the expected type for that parameter with error type securityerror, if the application does not have the privilege to call this method code example var gplaylists, gitems, gcurplaylist; function get2fail err { console log "get items after move item failed " + err ; } function get2success items { console log "playlist order after move " ; for var i = 0; i < items length ; ++i { console log "[" + i + "] name " + items[i] content name ; } } function movesuccess { console log "move item success" ; gcurplaylist get get2success, get2fail ; } function movefail err { console log "move item failed " + err ; } function getsuccess items { gitems = items; if gitems length < 2 { console log "please add at least 2 tracks to playlist!" ; return; } console log "original order " ; for var i = 0; i < gitems length ; ++i { console log "[" + i + "] name " + gitems[i] content name ; } console log "will move item at index [1] name " + gitems[1] content name + " up by one place to [0] " ; gcurplaylist move gitems[1], -1, movesuccess, movefail ; gitems unshift gitems splice 1, 1 [0] ; } function getfail err { console log "get items failed " + err ; } function getplaylistsfail err { console log "getplaylists failed " + err ; } function getplaylistssuccess playlists { gplaylists = playlists; if gplaylists length === 0 { console log "please create at least 1 playlist!" ; return; } gcurplaylist = gplaylists[0]; gcurplaylist get getsuccess, getfail ; } tizen content getplaylists getplaylistssuccess, getplaylistsfail ; 2 15 playlistarraysuccesscallback the playlistarraysuccesscallback interface specifies a success callback that is invoked when all existing playlists are retrieved successfully [callback=functiononly, nointerfaceobject] interface playlistarraysuccesscallback { void onsuccess playlist[] playlists ; }; since 2 3 it is used in tizen content getplaylists methods onsuccess called when the tizen content getplaylists method completes successfully onsuccess playlist[] playlists ; since 2 3 parameters playlists list of all playlists on a device 2 16 playlistsuccesscallback the playlistsuccesscallback interface specifies a success callback that is invoked when a new playlist is successfully created [callback=functiononly, nointerfaceobject] interface playlistsuccesscallback { void onsuccess playlist playlist ; }; since 2 3 it is used in tizen content createplaylist methods onsuccess called when the tizen content createplaylist method completes successfully onsuccess playlist playlist ; since 2 3 parameters playlist newly created playlist 2 17 playlistitemarraysuccesscallback the playlistitemarraysuccesscallback interface specifies a success callback that is invoked when a list of playlist items are successfully retrieved [callback=functiononly, nointerfaceobject] interface playlistitemarraysuccesscallback { void onsuccess playlistitem[] items ; }; since 2 3 methods onsuccess called when the playlist get method completes successfully onsuccess playlistitem[] items ; since 2 3 parameters items list of playlist items 2 18 thumbnailsuccesscallback the thumbnailsuccesscallback interface specifies a success callback that is invoked when a content's thumbnail is successfully created [callback=functiononly, nointerfaceobject] interface thumbnailsuccesscallback { void onsuccess domstring path ; }; since 3 0 methods onsuccess called when the tizen content createthumbnail method completes successfully onsuccess domstring path ; since 3 0 parameters path path of the created thumbnail 3 full webidl module content { enum contentdirectorystoragetype { "internal", "external" }; enum contenttype { "image", "video", "audio", "other" }; enum audiocontentlyricstype { "synchronized", "unsynchronized" }; enum imagecontentorientation { "normal", "flip_horizontal", "rotate_180", "flip_vertical", "transpose", "rotate_90", "transverse", "rotate_270" }; typedef domstring contentid; typedef domstring contentdirectoryid; typedef domstring playlistid; [nointerfaceobject] interface contentmanagerobject { readonly attribute contentmanager content; }; tizen implements contentmanagerobject; [nointerfaceobject] interface contentmanager { void update content content raises webapiexception ; void updatebatch content[] contents, optional successcallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void getdirectories contentdirectoryarraysuccesscallback successcallback, optional errorcallback? errorcallback raises webapiexception ; void find contentarraysuccesscallback successcallback, optional errorcallback? errorcallback, optional contentdirectoryid? directoryid, optional abstractfilter? filter, optional sortmode? sortmode, optional unsigned long? count, optional unsigned long? offset raises webapiexception ; void scanfile domstring contenturi, optional contentscansuccesscallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void scandirectory domstring contentdiruri, boolean recursive, optional contentscansuccesscallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void cancelscandirectory domstring contentdiruri raises webapiexception ; ```java void contentchangecallback changecallback raises webapiexception ; void removechangelistener long listenerid raises webapiexception ; void setchangelistener contentchangecallback changecallback raises webapiexception ; void unsetchangelistener raises webapiexception ; void getplaylists playlistarraysuccesscallback successcallback, optional errorcallback? errorcallback raises webapiexception ; void createplaylist domstring name, playlistsuccesscallback successcallback, optional errorcallback? errorcallback, optional playlist? sourceplaylist raises webapiexception ; void removeplaylist playlistid id, optional successcallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void createthumbnail content content, thumbnailsuccesscallback successcallback, optional errorcallback? errorcallback raises webapiexception ; }; [callback=functiononly, nointerfaceobject] interface contentarraysuccesscallback { void onsuccess content[] contents ; }; [callback=functiononly, nointerfaceobject] interface contentdirectoryarraysuccesscallback { void onsuccess contentdirectory[] directories ; }; [callback=functiononly, nointerfaceobject] interface contentscansuccesscallback { void onsuccess domstring uri ; }; [callback, nointerfaceobject] interface contentchangecallback { void oncontentadded content content ; void oncontentupdated content content ; void oncontentremoved contentid id ; void oncontentdiradded contentdirectory contentdir ; void oncontentdirupdated contentdirectory contentdir ; void oncontentdirremoved contentdirectoryid id ; }; [nointerfaceobject] interface contentdirectory { readonly attribute contentdirectoryid id; readonly attribute domstring directoryuri; readonly attribute domstring title; readonly attribute contentdirectorystoragetype storagetype; readonly attribute date? modifieddate; }; [nointerfaceobject] interface content { readonly attribute domstring[] editableattributes; readonly attribute contentid id; attribute domstring name; readonly attribute contenttype type; readonly attribute domstring mimetype; readonly attribute domstring title; readonly attribute domstring contenturi; readonly attribute domstring[]? thumbnailuris; readonly attribute date? releasedate; readonly attribute date? modifieddate; readonly attribute unsigned long size; attribute domstring? description; attribute unsigned long rating; attribute boolean isfavorite; }; [nointerfaceobject] interface videocontent content { attribute simplecoordinates? geolocation; readonly attribute domstring? album; readonly attribute domstring[]? artists; readonly attribute unsigned long duration; readonly attribute unsigned long width; readonly attribute unsigned long height; }; [nointerfaceobject] interface audiocontentlyrics { readonly attribute audiocontentlyricstype type; readonly attribute unsigned long[] timestamps; readonly attribute domstring[] texts; }; [nointerfaceobject] interface audiocontent content { readonly attribute domstring? album; readonly attribute domstring[]? genres; readonly attribute domstring[]? artists; readonly attribute domstring[]? composers; readonly attribute audiocontentlyrics? lyrics; readonly attribute domstring? copyright; readonly attribute unsigned long bitrate; readonly attribute unsigned short? tracknumber; readonly attribute unsigned long duration; }; [nointerfaceobject] interface imagecontent content { attribute simplecoordinates? geolocation; readonly attribute unsigned long width; readonly attribute unsigned long height; attribute imagecontentorientation orientation; }; [nointerfaceobject] interface playlistitem { readonly attribute content content; }; [nointerfaceobject] interface playlist { readonly attribute playlistid id; attribute domstring name raises webapiexception ; readonly attribute long numberoftracks; attribute domstring? thumbnailuri raises webapiexception ; void add content item raises webapiexception ; void addbatch content[] items, optional successcallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void remove playlistitem item raises webapiexception ; void removebatch playlistitem[] items, optional successcallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void get playlistitemarraysuccesscallback successcallback, optional errorcallback? errorcallback, optional long? count, optional long? offset raises webapiexception ; void setorder playlistitem[] items, optional successcallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; void move playlistitem item, long delta, optional successcallback? successcallback, optional errorcallback? errorcallback raises webapiexception ; }; [callback=functiononly, nointerfaceobject] interface playlistarraysuccesscallback { void onsuccess playlist[] playlists ; }; [callback=functiononly, nointerfaceobject] interface playlistsuccesscallback { void onsuccess playlist playlist ; }; [callback=functiononly, nointerfaceobject] interface playlistitemarraysuccesscallback { void onsuccess playlistitem[] items ; }; [callback=functiononly, nointerfaceobject] interface thumbnailsuccesscallback { void onsuccess domstring path ; }; };