Class MediaDatabase
Definition
- Namespace:
- Tizen.Content.MediaContent
- Assembly:
- Tizen.Content.MediaContent.dll
- API Level:
- 4
Provides the ability to connect to and manage the database.
public class MediaDatabase : IDisposable
- Inheritance
-
MediaDatabase
- Implements
Constructors
View SourceMediaDatabase()
Initializes a new instance of the MediaDatabase class.
Declaration
public MediaDatabase()
API Level: 4
Properties
View SourceIsDisposed
Gets the value indicating whether the database has been disposed.
Declaration
public bool IsDisposed { get; }
Property Value
Type | Description |
---|---|
Boolean | true if the database has been disposed; otherwise, false. |
API Level: 4
Methods
View SourceConnect()
Connects to the database.
Declaration
public void Connect()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The database is already connected. |
ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while connecting. |
API Level: 4
View SourceDisconnect()
Disconnects from the media database.
Declaration
public void Disconnect()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The database is not connected. |
ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while connecting. |
API Level: 4
View SourceDispose()
Releases all the resources.
Declaration
public void Dispose()
API Level: 4
View SourceDispose(Boolean)
Disposes of the resources (other than memory) used by the MediaDatabase.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
API Level: 4
View SourceScanFile(String)
Requests to scan a media file.
Declaration
public void ScanFile(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path of the media to be scanned. |
Remarks
It requests to scan a media file to the media server.
If the specified file is not registered to the database yet,
the media file information will be added to the database.
If it is already registered to the database, the media information is refreshed.
If the specified file does not exist,
the record of the media file will be deleted from the database.
If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
If http://tizen.org/feature/content.scanning.others feature is not supported and the specified file is other-type,
NotSupportedException will be thrown.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The database is not connected. |
ObjectDisposedException | The MediaDatabase has already been disposed. |
ArgumentNullException |
|
ArgumentException |
|
UnauthorizedAccessException | The caller has no required privilege. |
NotSupportedException | The required feature is not supported. |
API Level: 4
Privilege Level: public
Privilege: http://tizen.org/privilege/content.writehttp://tizen.org/privilege/mediastoragehttp://tizen.org/privilege/externalstorage
View SourceScanFolderAsync(String)
Requests to scan a folder recursively.
Declaration
public Task ScanFolderAsync(string folderPath)
Parameters
Type | Name | Description |
---|---|---|
String | folderPath | The path to scan. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous scan operation. |
Remarks
If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The database is not connected. |
ObjectDisposedException | The MediaDatabase has already been disposed. |
UnauthorizedAccessException | The caller has no required privilege. |
ArgumentNullException |
|
ArgumentException |
|
API Level: 4
Privilege Level: public
Privilege: http://tizen.org/privilege/content.writehttp://tizen.org/privilege/mediastoragehttp://tizen.org/privilege/externalstorage
View SourceScanFolderAsync(String, Boolean)
Requests to scan a folder.
Declaration
public Task ScanFolderAsync(string folderPath, bool recursive)
Parameters
Type | Name | Description |
---|---|---|
String | folderPath | The path to scan. |
Boolean | recursive | The value indicating if the folder is to be recursively scanned. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous scan operation. |
Remarks
If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The database is not connected. |
ObjectDisposedException | The MediaDatabase has already been disposed. |
UnauthorizedAccessException | The caller has no required privilege. |
ArgumentNullException |
|
ArgumentException |
|
API Level: 4
Privilege Level: public
Privilege: http://tizen.org/privilege/content.writehttp://tizen.org/privilege/mediastoragehttp://tizen.org/privilege/externalstorage
View SourceScanFolderAsync(String, Boolean, CancellationToken)
Requests to scan a folder.
Declaration
public Task ScanFolderAsync(string folderPath, bool recursive, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
String | folderPath | The path to scan. |
Boolean | recursive | The value indicating if the folder is to be recursively scanned. |
CancellationToken | cancellationToken | The token to stop scanning. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous scan operation. |
Remarks
If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The database is not connected. |
ObjectDisposedException | The MediaDatabase has already been disposed. |
UnauthorizedAccessException | The caller has no required privilege. |
ArgumentNullException |
|
ArgumentException |
|
API Level: 4
Privilege Level: public
Privilege: http://tizen.org/privilege/content.writehttp://tizen.org/privilege/mediastoragehttp://tizen.org/privilege/externalstorage
View SourceScanFolderAsync(String, CancellationToken)
Requests to scan a folder recursively.
Declaration
public Task ScanFolderAsync(string folderPath, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
String | folderPath | The path to scan. |
CancellationToken | cancellationToken | The token to stop scanning. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous scan operation. |
Remarks
If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The database is not connected. |
ObjectDisposedException | The MediaDatabase has already been disposed. |
UnauthorizedAccessException | The caller has no required privilege. |
ArgumentNullException |
|
ArgumentException |
|
API Level: 4
Privilege Level: public
Privilege: http://tizen.org/privilege/content.writehttp://tizen.org/privilege/mediastoragehttp://tizen.org/privilege/externalstorage
Events
View SourceFolderUpdated
Occurs when there is a change for the folder in the database.
Declaration
public static event EventHandler<FolderUpdatedEventArgs> FolderUpdated
Event Type
Type | Description |
---|---|
EventHandler<FolderUpdatedEventArgs> |
API Level: 4
View SourceMediaInfoUpdated
Occurs when there is a change for media in the database.
Declaration
public static event EventHandler<MediaInfoUpdatedEventArgs> MediaInfoUpdated
Event Type
Type | Description |
---|---|
EventHandler<MediaInfoUpdatedEventArgs> |