From dbd60cb33ef1f2968bfffa8c1be31bd8e4734d00 Mon Sep 17 00:00:00 2001 From: Andrzej Popowski Date: Tue, 14 Jun 2016 12:24:34 +0200 Subject: [PATCH] [Content] - createThumbail() implemented Change-Id: I39d3ccea17a093a8fc86ec881b6b8df05bb83c8b Signed-off-by: Andrzej Popowski --- .../html/web/tizen/content/content_w.htm | 5 +- .../html/web/tizen/content/content_tutorial_w.htm | 17 ++ .../html/device_api/mobile/tizen/content.html | 229 +++++++++++++++++---- .../html/device_api/tv/tizen/content.html | 140 ++++++++++++- .../html/device_api/wearable/tizen/content.html | 229 +++++++++++++++++---- 5 files changed, 540 insertions(+), 80 deletions(-) diff --git a/org.tizen.guides/html/web/tizen/content/content_w.htm b/org.tizen.guides/html/web/tizen/content/content_w.htm index c5d42a8..c4bee97 100644 --- a/org.tizen.guides/html/web/tizen/content/content_w.htm +++ b/org.tizen.guides/html/web/tizen/content/content_w.htm @@ -52,6 +52,9 @@
  • Content management

    You can view and edit content item details. The details are common file information and metadata attributes of the media file.

    To view content item details, use the find() method. To update some attributes of a content item, for example its rating, use the update() method.

    For more information on the content attributes, see the Content Full WebIDL Reference (in mobile and wearable applications).

    If a content item is copied or moved, you cannot find it because a scan is not performed automatically. To retrieve the copied or moved item, use the find() method after calling the scanFile() method.

    +

    + You can create thumbnail for a content item using the function tizen.content.createThumbnail(). +

    @@ -100,4 +103,4 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga - \ No newline at end of file + diff --git a/org.tizen.tutorials/html/web/tizen/content/content_tutorial_w.htm b/org.tizen.tutorials/html/web/tizen/content/content_tutorial_w.htm index b4eee22..ce63929 100644 --- a/org.tizen.tutorials/html/web/tizen/content/content_tutorial_w.htm +++ b/org.tizen.tutorials/html/web/tizen/content/content_tutorial_w.htm @@ -162,6 +162,23 @@ tizen.filesystem.resolve("images/photo.jpg", function(file)                             tizen.content.scanFile(file.toURI(), onScanSuccessCallback);                          }); +
  • +

    +To create a thumbnail for a content item, use the function createThumbnail(). +

    +function createCB(path) {
    +    console.log("A path of a just created thumbnail is " + path);
    +}
    +
    +function findCB(contents) {
    +    if (contents.length > 0) {
    +        tizen.content.createThumbnail(contents[0], createCB);
    +    }
    +}
    +
    +tizen.content.find(findCB);
    +
    +
  • Receiving Notifications on Content Changes

    diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/content.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/content.html index 5938e78..43d083a 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/content.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/content.html @@ -31,19 +31,26 @@ Playlist functionality has been added in Tizen 2.3.

    Table of Contents

  • 3. Full WebIDL @@ -101,39 +110,44 @@ Playlist functionality has been added in Tizen 2.3.
  • - + - + - + - + - + @@ -165,25 +179,31 @@ Playlist functionality has been added in Tizen 2.3. - + - + - + - + + + + +
    ContentManagervoid 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)
    - void setChangeListener (ContentChangeCallback changeCallback)
    - void unsetChangeListener ()
    - 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 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)
    + + +
    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)
    +
    ContentArraySuccessCallbackvoid onsuccess (Content[] contents)
    void onsuccess (Content[] contents)
    ContentDirectoryArraySuccessCallbackvoid onsuccess (ContentDirectory[] directories)
    void onsuccess (ContentDirectory[] directories)
    ContentScanSuccessCallbackvoid onsuccess (DOMString uri)
    void onsuccess (DOMString uri)
    ContentChangeCallbackvoid oncontentadded (Content content)
    - void oncontentupdated (Content content)
    - void oncontentremoved (ContentId id)
    - void oncontentdiradded (ContentDirectory contentDir)
    - void oncontentdirupdated (ContentDirectory contentDir)
    - void oncontentdirremoved (ContentDirectoryId id)
    +
    void oncontentadded (Content content)
    +
    void oncontentupdated (Content content)
    + + + + +
    ContentDirectory
    Playlistvoid 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)
    +
    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)
    +
    PlaylistArraySuccessCallbackvoid onsuccess (Playlist[] playlists)
    void onsuccess (Playlist[] playlists)
    PlaylistSuccessCallbackvoid onsuccess (Playlist playlist)
    void onsuccess (Playlist playlist)
    PlaylistItemArraySuccessCallbackvoid onsuccess (PlaylistItem[] items)
    void onsuccess (PlaylistItem[] items)
    ThumbnailSuccessCallback
    void onsuccess (DOMString path)
    @@ -351,6 +371,9 @@ The tizen.content object allows accessing the functionality of the Cont optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); + void createThumbnail(Content content, + ThumbnailSuccessCallback successCallback, + optional ErrorCallback? errorCallback) raises(WebAPIException); };

    Since: @@ -602,7 +625,7 @@ is not compatible with the expected type for that parameter.

    This method allows searching based on a supplied filter. For more details on AbstractFilter, see the -Tizen module. The filter allows precise searching such +Tizen module. The filter allows precise searching such as "return all songs by artist U2, ordered by name".

    @@ -1341,6 +1364,86 @@ UnknownError: In case of any error

  • +
    +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
    + 
    +
    +
    @@ -3260,6 +3363,47 @@ It is used in tizen.content.createPlaylist(). +
    +

    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. +
    +
    void onsuccess(DOMString path);
    +             
    +

    + Since: + 3.0 +

    +
    +

    Parameters:

    +
      +
    • +path: + Path of the created thumbnail +
    • +
    +
    +
    +
    +
    +

    3. Full WebIDL

    module Content {
    @@ -3330,6 +3474,9 @@ It is used in tizen.content.createPlaylist().
                             optional SuccessCallback? successCallback,
                             optional ErrorCallback? errorCallback) raises(WebAPIException);
     
    +    void createThumbnail(Content content,
    +                         ThumbnailSuccessCallback successCallback,
    +                         optional ErrorCallback? errorCallback) raises(WebAPIException);
       };
     
       [Callback=FunctionOnly, NoInterfaceObject] interface ContentArraySuccessCallback {
    @@ -3516,6 +3663,10 @@ It is used in tizen.content.createPlaylist().
       [Callback=FunctionOnly, NoInterfaceObject] interface PlaylistItemArraySuccessCallback {
         void onsuccess(PlaylistItem[] items);
       };
    +
    +  [Callback=FunctionOnly, NoInterfaceObject] interface ThumbnailSuccessCallback {
    +    void onsuccess(DOMString path);
    +  };
     };
    +
    +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
    + 
    +
    +
    @@ -1620,7 +1710,7 @@ UnknownError: In case of any error @@ -3275,6 +3365,47 @@ It is used in tizen.content.createPlaylist(). +
    +

    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. +
    +
    void onsuccess(DOMString path);
    +             
    +

    + Since: + 3.0 +

    +
    +

    Parameters:

    +
      +
    • +path: + Path of the created thumbnail +
    • +
    +
    +
    +
    +
    +

    3. Full WebIDL

    module Content {
    @@ -3345,6 +3476,9 @@ It is used in tizen.content.createPlaylist().
                             optional SuccessCallback? successCallback,
                             optional ErrorCallback? errorCallback) raises(WebAPIException);
     
    +    void createThumbnail(Content content,
    +                         ThumbnailSuccessCallback successCallback,
    +                         optional ErrorCallback? errorCallback) raises(WebAPIException);
       };
     
       [Callback=FunctionOnly, NoInterfaceObject] interface ContentArraySuccessCallback {
    @@ -3531,6 +3665,10 @@ It is used in tizen.content.createPlaylist().
       [Callback=FunctionOnly, NoInterfaceObject] interface PlaylistItemArraySuccessCallback {
         void onsuccess(PlaylistItem[] items);
       };
    +
    +  [Callback=FunctionOnly, NoInterfaceObject] interface ThumbnailSuccessCallback {
    +    void onsuccess(DOMString path);
    +  };
     };
    +
    +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
    + 
    +
    +
    @@ -3260,6 +3363,47 @@ It is used in tizen.content.createPlaylist(). +
    +

    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. +
    +
    void onsuccess(DOMString path);
    +             
    +

    + Since: + 3.0 +

    +
    +

    Parameters:

    +
      +
    • +path: + Path of the created thumbnail +
    • +
    +
    +
    +
    +
    +

    3. Full WebIDL

    module Content {
    @@ -3330,6 +3474,9 @@ It is used in tizen.content.createPlaylist().
                             optional SuccessCallback? successCallback,
                             optional ErrorCallback? errorCallback) raises(WebAPIException);
     
    +    void createThumbnail(Content content,
    +                         ThumbnailSuccessCallback successCallback,
    +                         optional ErrorCallback? errorCallback) raises(WebAPIException);
       };
     
       [Callback=FunctionOnly, NoInterfaceObject] interface ContentArraySuccessCallback {
    @@ -3516,6 +3663,10 @@ It is used in tizen.content.createPlaylist().
       [Callback=FunctionOnly, NoInterfaceObject] interface PlaylistItemArraySuccessCallback {
         void onsuccess(PlaylistItem[] items);
       };
    +
    +  [Callback=FunctionOnly, NoInterfaceObject] interface ThumbnailSuccessCallback {
    +    void onsuccess(DOMString path);
    +  };
     };