internal static extern int GetPlayedCount(SafeMediaInformationHandle mediaInformationHandle, out int playedCount);
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_played_time", CallingConvention = CallingConvention.Cdecl)]
- internal static extern int GetPlayedTime(SafeMediaInformationHandle mediaInformationHandle, out int playedTime);
+ internal static extern int GetPlayedAt(SafeMediaInformationHandle mediaInformationHandle, out int playedTime);
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_from_db", CallingConvention = CallingConvention.Cdecl)]
internal static extern int GetMediaFromDB(string mediaId, out SafeMediaInformationHandle mediaInformationHandle);
internal static extern int IncreasePlayedCount(SafeMediaInformationHandle mediaInformationHandle);
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_played_time", CallingConvention = CallingConvention.Cdecl)]
- internal static extern int SetPlayedTime(SafeMediaInformationHandle mediaInformationHandle);
+ internal static extern int SetPlayedAt(SafeMediaInformationHandle mediaInformationHandle);
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_display_name", CallingConvention = CallingConvention.Cdecl)]
internal static extern int SetDisplayName(SafeMediaInformationHandle mediaInformationHandle, string displayName);
namespace Tizen.Content.MediaContent
{
/// <summary>
- /// AudioContent class API gives the information related to the audio media stored in the device</summary>
+ /// AudioContent class API gives the information related to the audio media stored in the device
+ /// Its purpose is threefold:
+ /// - to provide information about audio content
+ /// - to organize audio content logically(grouping)
+ /// </summary>
public class AudioInformation : MediaInformation
{
private readonly Interop.AudioInformation.SafeAudioInformationHandle _handle;
/// <summary>
/// Gets the tag ID for the media.
/// </summary>
- /// <value> string tag ID</value>
- public override string MediaId
+ public string MediaId
{
get
{
/// <summary>
/// Gets the album name.
+ /// If the value is an empty string, the method returns "Unknown".
+ /// If the media content has no album info, the method returns empty string.
/// </summary>
- /// <value> string album name</value>
public string Album
{
get
/// <summary>
/// Gets the artist name.
+ /// If the value is an empty string, the method returns "Unknown".
+ /// If the media content has no album info, the method returns empty string.
/// </summary>
- /// <value> string artist name</value>
public string Artist
{
get
/// <summary>
/// Gets the album artist name.
+ /// If the value is an empty string, the method returns "Unknown".
+ /// If the media content has no album info, the method returns empty string.
/// </summary>
- /// <value> string album artist name</value>
public string AlbumArtist
{
get
/// <summary>
/// Gets the genre name.
+ /// If the value is an empty string, the method returns "Unknown".
+ /// If the media content has no album info, the method returns empty string.
/// </summary>
- /// <value> string genre name</value>
public string Genre
{
get
/// <summary>
/// Gets the composer name.
+ /// If the value is an empty string, the method returns "Unknown".
+ /// If the media content has no album info, the method returns empty string.
/// </summary>
- /// <value> string composer name</value>
public string Composer
{
get
/// <summary>
/// Gets the year.
+ /// If the value is an empty string, the method returns "Unknown".
+ /// If the media content has no album info, the method returns empty string.
/// </summary>
- /// <value> string year</value>
public string Year
{
get
/// <summary>
/// Gets the recorded date.
/// </summary>
- /// <value> string recorded date</value>
public string RecordedDate
{
get
/// <summary>
/// Gets the copyright notice.
+ /// If the media content has no copyright info, the method returns empty string.
/// </summary>
- /// <value> string copyright notice</value>
public string Copyright
{
get
/// <summary>
/// Gets the track number.
+ /// If the value is an empty string, the method returns "Unknown".
/// </summary>
- /// <value> string track number</value>
public string TrackNumber
{
get
}
/// <summary>
- /// Gets the bitrate.
+ /// Gets the bitrate in bit per second [bps].
/// </summary>
- /// <value> int bitrate</value>
public int BitRate
{
get
/// <summary>
/// Gets bit per sample.
/// </summary>
- /// <value> int bit per sample value</value>
public int BitPerSample
{
get
}
/// <summary>
- /// Gets the sample rate.
+ /// Gets the sample rate in hz.
/// </summary>
- /// <value> int sample rate value</value>
public int SampleRate
{
get
/// <summary>
/// Gets the channel.
/// </summary>
- /// <value> int channel value</value>
public int Channel
{
get
}
/// <summary>
- /// Gets the track duration.
+ /// Gets the track duration in Milliseconds.
/// </summary>
- /// <value> int track duration value</value>
public int Duration
{
get
}
/// <summary>
- /// Number which represents how many times given audio has been played.
- /// </summary>
- /// <value> bool value </value>
- public new int PlayedCount
- {
- get
- {
- int playedCount = 0;
- int result = Interop.AudioInformation.GetPlayedCount(_handle, out playedCount);
- if ((MediaContentError)result != MediaContentError.None)
- {
- Log.Error(Globals.LogTag, "Error Occured with error code: " + (MediaContentError)result);
- }
- return playedCount;
- }
- set
- {
- int result = Interop.AudioInformation.SetPlayedCount(_handle, value);
- if ((MediaContentError)result != MediaContentError.None)
- {
- throw MediaContentErrorFactory.CreateException((MediaContentError)result, "failed to set played count");
- }
- }
- }
-
- /// <summary>
- /// Audio's played time parameter.
- /// </summary>
- /// <value> DateTime</value>
- public new DateTime PlayedAt
- {
- get
- {
- DateTime playedAt;
- int time;
- int result = Interop.AudioInformation.GetPlayedTime(_handle, out time);
- if ((MediaContentError)result != MediaContentError.None)
- {
- Log.Error(Globals.LogTag, "Error Occured with error code: " + (MediaContentError)result);
- }
- DateTime utc;
- if (time != 0)
- {
- Tizen.Log.Info(Globals.LogTag, "Ticks received: " + time);
- utc = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(time), DateTimeKind.Utc);
- playedAt = utc.ToLocalTime();
- }
- else
- {
- Tizen.Log.Info(Globals.LogTag, "No Date received");
- playedAt = DateTime.Now;
- }
- return playedAt;
- }
-
- set
- {
- int result = Interop.AudioInformation.SetPlayedTime(_handle, (int)value.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds);
- if ((MediaContentError)result != MediaContentError.None)
- {
- throw MediaContentErrorFactory.CreateException((MediaContentError)result, "Failed to SetValue for AudioInfo");
- }
- }
- }
-
- /// <summary>
- /// Audio's played position parameter.
- /// </summary>
- /// <value> DateTime</value>
- public int PlayedPosition
- {
- get
- {
- int playedCount = 0;
- int result = Interop.AudioInformation.GetPlayedPosition(_handle, out playedCount);
- if ((MediaContentError)result != MediaContentError.None)
- {
- Log.Error(Globals.LogTag, "Error Occured with error code: " + (MediaContentError)result);
- }
- return playedCount;
- }
- set
- {
- int result = Interop.AudioInformation.SetPlayedPosition(_handle, value);
- if ((MediaContentError)result != MediaContentError.None)
- {
- throw MediaContentErrorFactory.CreateException((MediaContentError)result, "Failed to set audio played position");
- }
- }
- }
-
- /// <summary>
/// Gets the number of bookmarks for the passed filter in the given media ID from the media database.
/// </summary>
/// <returns>
/// <summary>
/// Gets the tag ID for the image.
/// </summary>
- /// <value> string tag ID</value>
- public override string MediaId
+ public string MediaId
{
get
{
/// <summary>
/// Gets the image width in pixels.
/// </summary>
- /// <value> int image width value</value>
public int Width
{
get
/// <summary>
/// Gets the image height in pixels.
/// </summary>
- /// <value> int image height value</value>
public int Height
{
get
/// <summary>
/// Image orientation.
/// </summary>
- /// <value> MediaContentOrientation image orientation value</value>
public MediaContentOrientation Orientation
{
get
}
/// <summary>
- /// Gets the image creation time.
+ /// Gets the image creation time in seconds, since the Epoch.
/// </summary>
- /// <value> string </value>
public string TakenDate
{
get
/// <summary>
/// Gets the burst shot ID.
+ /// If burst_id is Empty, this is not burst shot
/// </summary>
- /// <value> string </value>
public string BurstId
{
get
/// <summary>
/// Gets the exposure time from exif.
/// </summary>
- /// <value> string </value>
public string ExposureTime
{
get
/// <summary>
/// Gets the fnumber from exif.
/// </summary>
- /// <value> double </value>
public double FNumber
{
get
/// <summary>
/// Gets the iso from exif.
/// </summary>
- /// <value> int </value>
public int Iso
{
get
/// <summary>
/// Gets the model from exif.
/// </summary>
- /// <value> string </value>
public string Model
{
get
/// <summary>
/// Checks whether the media is a burst shot image.
+ /// The value is true if the media is a burst shot image,
+ /// otherwise false if the media is not a burst shot image.
/// </summary>
- /// <value> bool </value>
public bool IsBurstShot
{
get
/// <summary>
/// Creates a thumbnail image for the given media, asynchronously
+ /// If a thumbnail already exists for the given media, then the path of thumbnail will be returned.
/// </summary>
/// <returns>
/// Task for creation of Thumbnail </returns>
/// <summary>
/// Creates a thumbnail image for the given media, asynchronously
/// which can be cancelled
+ /// If a thumbnail already exists for the given media, then the path of thumbnail will be returned.
/// </summary>
/// <returns>
/// Task for creation of Thumbnail </returns>
/// <summary>
/// Gets the tag ID for the media.
/// </summary>
- /// <value> string tag ID</value>
public virtual string MediaId
{
get
/// <summary>
/// Gets the path to the media.
/// </summary>
- /// <value> string path</value>
public string FilePath
{
get
/// <summary>
/// Name of the media.
/// </summary>
- /// <value> string diaply name</value>
public string DisplayName
{
get
/// <summary>
/// Gets the content type of the media.
/// </summary>
- /// <value> string diaply name</value>
public MediaContentType MediaType
{
get
/// <summary>
/// Gets the MIME type from the media.
/// </summary>
- /// <value> string mime type</value>
public string MimeType
{
get
}
/// <summary>
- /// Gets the media file size.
+ /// Gets the media file size in Bytes.
/// </summary>
- /// <value> long size</value>
public long Size
{
get
/// <summary>
/// Addition time of the media.
/// </summary>
- /// <value> DateTime</value>
public DateTime AddedAt
{
get
/// <summary>
/// Gets the date of modification of media.
/// </summary>
- /// <value> DateTime</value>
public DateTime ModifiedAt
{
get
/// <summary>
/// Gets the timeline of media.
/// </summary>
- /// <value> DateTime</value>
public DateTime TimeLine
{
get
/// <summary>
/// Gets the thumbnail of media.
/// </summary>
- /// <value> string thumbnail path</value>
public string ThumbnailPath
{
get
/// <summary>
/// Description of media.
+ /// If the media info has no description, the method returns empty string.
/// </summary>
- /// <value> string description</value>
public string Description
{
get
}
/// <summary>
- /// longitude of media.
+ /// Longitude of media.
+ /// Default Value is 0.0.
/// </summary>
- /// <value> double Longitude</value>
public double Longitude
{
get
}
/// <summary>
- /// latitude of media.
+ /// Latitude of media.
+ /// Default Value is 0.0.
/// </summary>
- /// <value> double latitude</value>
public double Latitude
{
get
/// <summary>
/// Altitude of media.
+ /// Default Value is 0.0.
/// </summary>
- /// <value> double Altitude</value>
public double Altitude
{
get
/// <summary>
/// Weather of media.
+ /// Dafault is empty string.
/// </summary>
- /// <value> string value </value>
public string Weather
{
get
/// <summary>
/// Rating of media.
/// </summary>
- /// <value> int value </value>
public int Rating
{
get
/// <summary>
/// Favorite status of media.
+ /// true if media info is set as favorite, otherwise false if media info is not set as favorite.
/// </summary>
- /// <value> bool value </value>
public bool IsFavourite
{
get
/// <summary>
/// Author of media.
/// </summary>
- /// <value> string value </value>
public string Author
{
get
/// <summary>
/// Provider of media.
/// </summary>
- /// <value> string value </value>
public string Provider
{
get
/// <summary>
/// Content name of media.
/// </summary>
- /// <value> string value </value>
public string ContentName
{
get
/// <summary>
/// Gets the title of media.
/// </summary>
- /// <value> string value </value>
public string Title
{
get
/// <summary>
/// Category of media.
/// </summary>
- /// <value> string value </value>
public string Category
{
get
/// <summary>
/// location tag of media.
/// </summary>
- /// <value> string value </value>
public string LocationTag
{
get
/// <summary>
/// Age Rating of media.
/// </summary>
- /// <value> string value </value>
public string AgeRating
{
get
/// <summary>
/// Keyword of media.
/// </summary>
- /// <value> string value </value>
public string Keyword
{
get
/// <summary>
/// Gets the storage id of media.
/// </summary>
- /// <value> string value </value>
public string StorageId
{
get
/// <summary>
/// Checks whether the media is protected via DRM.
/// </summary>
- /// <value> bool value </value>
public bool IsDrm
{
get
/// <summary>
/// Gets the storage type of media.
/// </summary>
- /// <value> ContentStorageType </value>
public ContentStorageType StorageType
{
get
/// <summary>
/// Number which represents how many times given content has been played.
+ /// While Setting the played count, it will only be incremented by 1, the value provided will be ignored.
/// </summary>
- /// <value> bool value </value>
public int PlayedCount
{
get
}
set
{
- for (int i = PlayedCount; i <= value; i++)
+ int result = Interop.MediaInformation.IncreasePlayedCount(_handle);
+ if ((MediaContentError)result != MediaContentError.None)
{
- int result = Interop.MediaInformation.IncreasePlayedCount(_handle);
- if ((MediaContentError)result != MediaContentError.None)
- {
- throw MediaContentErrorFactory.CreateException((MediaContentError)result, "failed to set increase played count");
- }
+ throw MediaContentErrorFactory.CreateException((MediaContentError)result, "failed to set increase played count");
}
}
}
/// <summary>
- /// Content's played time parameter.
+ /// Content's latest played(opened) time of the media file.
+ /// for set the current time is automatically taken from the system, the value provided will be ignored.
/// </summary>
- /// <value> DateTime</value>
public DateTime PlayedAt
{
get
{
DateTime addedAt;
int time;
- int result = Interop.MediaInformation.GetPlayedTime(_handle, out time);
+ int result = Interop.MediaInformation.GetPlayedAt(_handle, out time);
if ((MediaContentError)result != MediaContentError.None)
{
Log.Error(Globals.LogTag, "Error Occured with error code: " + (MediaContentError)result);
}
return addedAt;
}
-
set
{
- int result = Interop.MediaInformation.SetPlayedTime(_handle);
+ int result = Interop.MediaInformation.SetPlayedAt(_handle);
if ((MediaContentError)result != MediaContentError.None)
{
throw MediaContentErrorFactory.CreateException((MediaContentError)result, "failed to set played time");
/// <summary>
/// Gets the tag ID for the media.
/// </summary>
- /// <value> string tag ID</value>
- public override string MediaId
+ public string MediaId
{
get
{
/// <summary>
/// Gets the album name.
+ /// If the value is an empty string, the method returns "Unknown".
/// </summary>
- /// <value> string album name</value>
public string Album
{
get
/// <summary>
/// Gets the artist name.
+ /// If the value is an empty string, the method returns "Unknown".
/// </summary>
- /// <value> string artist name</value>
public string Artist
{
get
/// <summary>
/// Gets the album artist name.
+ /// If the value is an empty string, the method returns "Unknown".
/// </summary>
- /// <value> string album artist name</value>
public string AlbumArtist
{
get
/// <summary>
/// Gets the genre name.
+ /// If the value is an empty string, the method returns "Unknown".
/// </summary>
- /// <value> string genre name</value>
public string Genre
{
get
/// <summary>
/// Gets the composer name.
+ /// If the value is an empty string, the method returns "Unknown".
/// </summary>
- /// <value> string composer name</value>
public string Composer
{
get
/// <summary>
/// Gets the year.
+ /// If the value is an empty string, the method returns "Unknown".
/// </summary>
- /// <value> string year</value>
public string Year
{
get
/// <summary>
/// Gets the recorded date.
/// </summary>
- /// <value> string recorded date</value>
public string RecordedDate
{
get
/// <summary>
/// Gets the copyright notice.
+ /// If the value is an empty string, the method returns "Unknown".
/// </summary>
- /// <value> string copyright notice</value>
public string Copyright
{
get
/// <summary>
/// Gets the track number.
+ /// If the value is an empty string, the method returns "Unknown".
/// </summary>
- /// <value> string track number</value>
public string TrackNumber
{
get
}
/// <summary>
- /// Gets the bitrate.
+ /// Gets the bitrate in bit per second [bps].
/// </summary>
- /// <value> int bitrate</value>
public int BitRate
{
get
}
/// <summary>
- /// Gets the track duration.
+ /// Gets the track duration in Milliseconds.
/// </summary>
- /// <value> int track duration value</value>
public int Duration
{
get
/// <summary>
/// Gets the video width in pixels.
/// </summary>
- /// <value> int video width value</value>
public int Width
{
get
/// <summary>
/// Gets the video height in pixels.
/// </summary>
- /// <value> int video height value</value>
public int Height
{
get
}
/// <summary>
- /// Number which represents how many times given vidoe has been played.
- /// </summary>
- /// <value> bool value </value>
- public new int PlayedCount
- {
- get
- {
- int playedCount = 0;
- int result = Interop.VideoInformation.GetPlayedCount(_handle, out playedCount);
- if ((MediaContentError)result != MediaContentError.None)
- {
- Log.Error(Globals.LogTag, "Error Occured with error code: " + (MediaContentError)result);
- }
- return playedCount;
- }
- set
- {
- int result = Interop.VideoInformation.SetPlayedCount(_handle, value);
- if ((MediaContentError)result != MediaContentError.None)
- {
- throw MediaContentErrorFactory.CreateException((MediaContentError)result, "Failed to set played count");
- }
- }
- }
-
- /// <summary>
- /// Video's played time parameter.
- /// </summary>
- /// <value> DateTime</value>
- public new DateTime PlayedAt
- {
- get
- {
- DateTime playedAt;
- int time;
- int result = Interop.VideoInformation.GetPlayedTime(_handle, out time);
- if ((MediaContentError)result != MediaContentError.None)
- {
- Log.Error(Globals.LogTag, "Error Occured with error code: " + (MediaContentError)result);
- }
- DateTime utc;
- if (time != 0)
- {
- Tizen.Log.Info(Globals.LogTag, "Ticks received: " + time);
- utc = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(time), DateTimeKind.Utc);
- playedAt = utc.ToLocalTime();
- }
- else
- {
- Tizen.Log.Info(Globals.LogTag, "No Date received");
- playedAt = DateTime.Now;
- }
- return playedAt;
- }
-
- set
- {
- int result = Interop.VideoInformation.SetPlayedTime(_handle, (int)value.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds);
- if ((MediaContentError)result != MediaContentError.None)
- {
- throw MediaContentErrorFactory.CreateException((MediaContentError)result, "failed to set played time");
- }
- }
- }
-
- /// <summary>
- /// Video's played position parameter.
- /// </summary>
- /// <value> DateTime</value>
- public int PlayedPosition
- {
- get
- {
- int playedCount = 0;
- int result = Interop.VideoInformation.GetPlayedPosition(_handle, out playedCount);
- if ((MediaContentError)result != MediaContentError.None)
- {
- Log.Error(Globals.LogTag, "Error Occured with error code: " + (MediaContentError)result);
- }
- return playedCount;
- }
- set
- {
- int result = Interop.VideoInformation.SetPlayedPosition(_handle, value);
- if ((MediaContentError)result != MediaContentError.None)
- {
- throw MediaContentErrorFactory.CreateException((MediaContentError)result, "failed to set played position");
- }
- }
- }
-
- /// <summary>
/// Gets the number of bookmarks for the passed filter in the given media ID from the media database.
/// </summary>
/// <returns>