/// <summary> /// Gets the language code for the specified index, or null if the language is undefined. /// </summary> /// <returns>The number of tracks.</returns> /// <remarks> /// <para>The <see cref="Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, /// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.</para> /// <para>The language codes are defined in ISO 639-1.</para> /// </remarks> /// <exception cref="ObjectDisposedException">The <see cref="Player"/> that this instance belongs to has been disposed of.</exception> /// <exception cref="InvalidOperationException">The <see cref="Player"/> that this instance belongs to is not in the valid state.</exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="index"/> is less than zero.<br/> /// -or-<br/> /// <paramref name="index"/> is equal to or greater than <see cref="GetCount()"/>. /// </exception> /// <since_tizen> 3 </since_tizen> public string GetLanguageCode(int index) { _owner.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); if (index < 0 || GetCount() <= index) { throw new ArgumentOutOfRangeException(nameof(index), index, $"Valid index range is 0 <= x < {nameof(GetCount)}(), but got { index }."); } IntPtr code = IntPtr.Zero; try { NativePlayer.GetTrackLanguageCode(_owner.Handle, _streamType, index, out code). ThrowIfFailed(_owner, "Failed to get the selected language of the player"); string result = Marshal.PtrToStringAnsi(code); if (result == "und") { Log.Error(PlayerLog.Tag, "not defined code"); return(null); } Log.Info(PlayerLog.Tag, "get language code : " + result); return(result); } finally { LibcSupport.Free(code); } }