/
Player.Properties.cs
793 lines (700 loc) · 30.2 KB
/
Player.Properties.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.IO;
using System.Threading;
using NativeDisplay = Interop.Display;
using static Interop;
namespace Tizen.Multimedia
{
/// <summary>
/// Represents properties for streaming buffering time.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public struct PlayerBufferingTime
{
/// <summary>
/// Initializes a new instance of the PlayerBufferingTime struct.
/// </summary>
/// <param name="preBufferMillisecond">A duration of buffering data that must be prerolled to start playback.</param>
/// Except 0 and -1, setting at least 1000 milliseconds is recommended to ensure the normal buffering operation.
/// 0 : use platform default value which could be different depending on the streaming type and network status. (the initial value)
/// -1 : use current value. (since 5.5)
/// <param name="reBufferMillisecond">A duration of buffering data that must be prerolled to resume playback,
/// when player is internally paused for buffering.
/// Except 0 and -1, setting at least 1000 milliseconds is recommended to ensure the normal buffering operation.
/// 0 : use platform default value, which depends on the streaming type and network status. It is set as the initial value of this parameter.
/// If the player state is <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/>,
/// this function will return correct time value instead of 0. (since 5.5)
/// -1 : use current value. (since 5.5)</param>
/// <since_tizen> 5 </since_tizen>
public PlayerBufferingTime(int preBufferMillisecond = -1, int reBufferMillisecond = -1)
{
PreBufferMillisecond = preBufferMillisecond;
ReBufferMillisecond = reBufferMillisecond;
}
/// <summary>
/// Gets or sets the duration of buffering data that must be prerolled to start playback.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public int PreBufferMillisecond
{
get;
set;
}
/// <summary>
/// Gets or sets the duration of buffering data that must be prerolled to resume playback
/// if player enters pause state for buffering.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public int ReBufferMillisecond
{
get;
set;
}
}
/// <since_tizen> 3 </since_tizen>
public partial class Player
{
/// <summary>
/// Gets the native handle of the player.
/// </summary>
/// <value>An IntPtr that contains the native handle of the player.</value>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <since_tizen> 3 </since_tizen>
public IntPtr Handle
{
get
{
ValidateNotDisposed();
return _handle.DangerousGetHandle();
}
}
#region Network configuration
private string _cookie = "";
private string _userAgent = "";
private const int MinBufferingTime = -1;
/// <summary>
/// Gets or sets the cookie for streaming playback.
/// </summary>
/// <remarks>To set, the player must be in the <see cref="PlayerState.Idle"/> state.</remarks>
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="ArgumentNullException">The value to set is null.</exception>
/// <since_tizen> 3 </since_tizen>
public string Cookie
{
get
{
return _cookie;
}
set
{
ValidatePlayerState(PlayerState.Idle);
if (value == null)
{
throw new ArgumentNullException(nameof(value), "Cookie can't be null.");
}
NativePlayer.SetStreamingCookie(Handle, value, value.Length).
ThrowIfFailed(this, "Failed to set the cookie to the player");
_cookie = value;
}
}
/// <summary>
/// Gets or sets the user agent for streaming playback.
/// </summary>
/// <remarks>To set, the player must be in the <see cref="PlayerState.Idle"/> state.</remarks>
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="ArgumentNullException">The value to set is null.</exception>
/// <since_tizen> 3 </since_tizen>
public string UserAgent
{
get
{
return _userAgent;
}
set
{
ValidatePlayerState(PlayerState.Idle);
if (value == null)
{
throw new ArgumentNullException(nameof(value), "UserAgent can't be null.");
}
NativePlayer.SetStreamingUserAgent(Handle, value, value.Length).
ThrowIfFailed(this, "Failed to set the user agent to the player");
_userAgent = value;
}
}
/// <summary>
/// Gets or sets the streaming buffering time.
/// </summary>
/// <remarks>To set, the player must be in the <see cref="PlayerState.Idle"/> state.</remarks>
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// <pramref name="PreBufferMillisecond"/> is less than -1.<br/>
/// -or-<br/>
/// <pramref name="ReBufferMillisecond"/> is less than -1.<br/>
/// </exception>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <seealso cref="PlayerBufferingTime"/>
/// <since_tizen> 5 </since_tizen>
public PlayerBufferingTime BufferingTime
{
get
{
ValidateNotDisposed();
NativePlayer.GetStreamingBufferingTime(Handle, out var PreBuffMillisecond, out var ReBuffMillisecond).
ThrowIfFailed(this, "Failed to get the buffering time of the player");
return new PlayerBufferingTime(PreBuffMillisecond, ReBuffMillisecond);
}
set
{
ValidatePlayerState(PlayerState.Idle);
if (value.PreBufferMillisecond < MinBufferingTime || value.ReBufferMillisecond < MinBufferingTime)
{
throw new ArgumentOutOfRangeException(nameof(value), value,
$"invalid range, got { value.PreBufferMillisecond }, { value.ReBufferMillisecond }.");
}
NativePlayer.SetStreamingBufferingTime(Handle, value.PreBufferMillisecond, value.ReBufferMillisecond).
ThrowIfFailed(this, "Failed to set the buffering time of the player");
}
}
#endregion
/// <summary>
/// Gets the state of the player.
/// </summary>
/// <value>The current state of the player.</value>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <since_tizen> 3 </since_tizen>
public PlayerState State
{
get
{
ValidateNotDisposed();
if (IsPreparing())
{
return PlayerState.Preparing;
}
NativePlayer.GetState(Handle, out var state).
ThrowIfFailed(this, "Failed to retrieve the state of the player");
Debug.Assert(Enum.IsDefined(typeof(PlayerState), state));
return (PlayerState)state;
}
}
/// <summary>
/// Gets or sets the audio latency mode.
/// </summary>
/// <value>A <see cref="AudioLatencyMode"/> that specifies the mode. The default is <see cref="AudioLatencyMode.Mid"/>.</value>
/// <remarks>
/// If the mode is <see cref="AudioLatencyMode.High"/>,
/// audio output interval can be increased, so it can keep more audio data to play.
/// But, state transition like pause or resume can be more slower than default(<see cref="AudioLatencyMode.Mid"/>).
/// </remarks>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="ArgumentException">The value is not valid.</exception>
/// <exception cref="NotAvailableException">
/// If audio offload is enabled by calling <see cref="AudioOffload.IsEnabled"/>. (Since tizen 6.0)
/// </exception>
/// <seealso cref="AudioOffload"/>
/// <since_tizen> 3 </since_tizen>
public AudioLatencyMode AudioLatencyMode
{
get
{
AudioOffload.CheckDisabled();
NativePlayer.GetAudioLatencyMode(Handle, out var value).
ThrowIfFailed(this, "Failed to get the audio latency mode of the player");
return value;
}
set
{
ValidateNotDisposed();
AudioOffload.CheckDisabled();
ValidationUtil.ValidateEnum(typeof(AudioLatencyMode), value, nameof(value));
NativePlayer.SetAudioLatencyMode(Handle, value).
ThrowIfFailed(this, "Failed to set the audio latency mode of the player");
}
}
/// <summary>
/// Gets or sets the looping state.
/// </summary>
/// <value>true if the playback is looping; otherwise, false. The default value is false.</value>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <since_tizen> 3 </since_tizen>
public bool IsLooping
{
get
{
NativePlayer.IsLooping(Handle, out var value).
ThrowIfFailed(this, "Failed to get the looping state of the player");
return value;
}
set
{
ValidateNotDisposed();
NativePlayer.SetLooping(Handle, value).
ThrowIfFailed(this, "Failed to set the looping state of the player");
}
}
#region Display methods
private PlayerDisplaySettings _displaySettings;
/// <summary>
/// Gets the display settings.
/// </summary>
/// <value>A <see cref="PlayerDisplaySettings"/> that specifies the display settings.</value>
/// <since_tizen> 3 </since_tizen>
public PlayerDisplaySettings DisplaySettings => _displaySettings;
private Display _display;
private PlayerErrorCode SetDisplay(Display display)
{
if (display == null)
{
return NativeDisplay.SetDisplay(Handle, PlayerDisplayType.None, IntPtr.Zero);
}
return display.ApplyTo(this);
}
private void ReplaceDisplay(Display newDisplay)
{
_display?.SetOwner(null);
_display = newDisplay;
_display?.SetOwner(this);
}
/// <summary>
/// Gets or sets the display.
/// </summary>
/// <value>A <see cref="Multimedia.Display"/> that specifies the display.</value>
/// <remarks>
/// The player must be in the <see cref="PlayerState.Idle"/> state.<br/>
/// The raw video feature(http://tizen.org/feature/multimedia.raw_video) is required if
/// the display is created with <see cref="MediaView"/>.
/// </remarks>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="ArgumentException">The value has already been assigned to another player.</exception>
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <since_tizen> 3 </since_tizen>
public Display Display
{
get
{
return _display;
}
set
{
ValidatePlayerState(PlayerState.Idle);
if (value != null && value.HasMediaView)
{
ValidationUtil.ValidateFeatureSupported(PlayerFeatures.RawVideo);
}
if (value?.Owner != null)
{
if (ReferenceEquals(this, value.Owner))
{
return;
}
throw new ArgumentException("The display has already been assigned to another.");
}
SetDisplay(value).ThrowIfFailed(this, "Failed to configure display of the player");
ReplaceDisplay(value);
}
}
PlayerErrorCode IDisplayable<PlayerErrorCode>.ApplyEvasDisplay(DisplayType type, ElmSharp.EvasObject evasObject)
{
Debug.Assert(IsDisposed == false);
Debug.Assert(Enum.IsDefined(typeof(DisplayType), type));
Debug.Assert(type != DisplayType.None);
return NativeDisplay.SetDisplay(Handle,
type == DisplayType.Overlay ? PlayerDisplayType.Overlay : PlayerDisplayType.Evas, evasObject);
}
PlayerErrorCode IDisplayable<PlayerErrorCode>.ApplyEcoreWindow(IntPtr windowHandle)
{
Debug.Assert(IsDisposed == false);
return NativeDisplay.SetEcoreDisplay(Handle, PlayerDisplayType.Overlay, windowHandle);
}
#endregion
private PlayerTrackInfo _audioTrack;
/// <summary>
/// Gets the track info for the audio.
/// </summary>
/// <value>A <see cref="PlayerTrackInfo"/> for audio.</value>
/// <since_tizen> 3 </since_tizen>
public PlayerTrackInfo AudioTrackInfo
{
get
{
if (_audioTrack == null)
{
_audioTrack = new PlayerTrackInfo(this, StreamType.Audio);
}
return _audioTrack;
}
}
private PlayerTrackInfo _subtitleTrackInfo;
/// <summary>
/// Gets the track info for the subtitle.
/// </summary>
/// <value>A <see cref="PlayerTrackInfo"/> for the subtitle.</value>
/// <since_tizen> 3 </since_tizen>
public PlayerTrackInfo SubtitleTrackInfo
{
get
{
if (_subtitleTrackInfo == null)
{
_subtitleTrackInfo = new PlayerTrackInfo(this, StreamType.Text);
}
return _subtitleTrackInfo;
}
}
private StreamInfo _streamInfo;
/// <summary>
/// Gets the stream information.
/// </summary>
/// <value>A <see cref="StreamInfo"/> for this player.</value>
/// <since_tizen> 3 </since_tizen>
public StreamInfo StreamInfo
{
get
{
if (_streamInfo == null)
{
_streamInfo = new StreamInfo(this);
}
return _streamInfo;
}
}
private AudioEffect _audioEffect;
/// <summary>
/// Gets the audio effect.
/// </summary>
/// <feature>http://tizen.org/feature/multimedia.custom_audio_effect</feature>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <since_tizen> 3 </since_tizen>
public AudioEffect AudioEffect
{
get
{
if (_audioEffect == null)
{
throw new NotSupportedException($"The feature({PlayerFeatures.AudioEffect}) is not supported.");
}
return _audioEffect;
}
}
/// <summary>
/// Gets or sets the mute state.
/// </summary>
/// <value>true if the player is muted; otherwise, false.</value>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <since_tizen> 3 </since_tizen>
public bool Muted
{
get
{
NativePlayer.IsMuted(Handle, out var value).
ThrowIfFailed(this, "Failed to get the mute state of the player");
Log.Info(PlayerLog.Tag, "get mute : " + value);
return value;
}
set
{
NativePlayer.SetMute(Handle, value).ThrowIfFailed(this, "Failed to set the mute state of the player");
}
}
/// <summary>
/// Gets or sets the current volume.
/// </summary>
/// <remarks>Valid volume range is from 0 to 1.0, inclusive.</remarks>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="value"/> is less than zero.<br/>
/// -or-<br/>
/// <paramref name="value"/> is greater than 1.0.
/// </exception>
/// <since_tizen> 3 </since_tizen>
public float Volume
{
get
{
float value = 0.0F;
NativePlayer.GetVolume(Handle, out value, out value).
ThrowIfFailed(this, "Failed to get the volume of the player");
return value;
}
set
{
if (value < 0F || 1.0F < value)
{
throw new ArgumentOutOfRangeException(nameof(value), value,
$"Valid volume range is 0 <= value <= 1.0, but got { value }.");
}
NativePlayer.SetVolume(Handle, value, value).
ThrowIfFailed(this, "Failed to set the volume of the player");
}
}
/// <summary>
/// Gets or sets the audio-only state.
/// </summary>
/// <value>true if the playback is audio-only mode; otherwise, false. The default value is false.</value>
/// The <see cref="Player"/> must be in the <see cref="PlayerState.Ready"/>,
/// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.
/// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <since_tizen> 5 </since_tizen>
public bool IsAudioOnly
{
get
{
ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
NativePlayer.IsAudioOnly(Handle, out var value).
ThrowIfFailed(this, "Failed to get the audio-only state of the player");
return value;
}
set
{
ValidateNotDisposed();
ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
NativePlayer.SetAudioOnly(Handle, value).
ThrowIfFailed(this, "Failed to set the audio-only state of the player");
}
}
/// <summary>
/// Gets or sets the player's replaygain state.
/// </summary>
/// <value>If the replaygain status is true, replaygain is applied (if contents has a replaygain tag);
/// otherwise, the replaygain is not affected by tag and properties.</value>
/// <remarks>This function could be unavailable depending on the audio codec type.</remarks>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="InvalidOperationException">
/// The player is not in the valid state.
/// </exception>
/// <exception cref="NotAvailableException">If audio offload is enabled by calling <see cref="AudioOffload.IsEnabled"/>. (Since tizen 6.0)
/// -or-<br/>
/// The function is not available depending on the audio codec type. (Since tizen 6.0)
/// </exception>
/// <seealso cref="AudioOffload"/>
/// <seealso cref="AudioCodecType"/>
/// <since_tizen> 5 </since_tizen>
public bool ReplayGain
{
get
{
ValidateNotDisposed();
AudioOffload.CheckDisabled();
NativePlayer.IsReplayGain(Handle, out var value).
ThrowIfFailed(this, "Failed to get the replaygain of the player");
return value;
}
set
{
ValidateNotDisposed();
AudioOffload.CheckDisabled();
NativePlayer.SetReplayGain(Handle, value).
ThrowIfFailed(this, "Failed to set the replaygain of the player");
}
}
/// <summary>
/// Enables or disables controlling the pitch of audio.
/// Gets the status of controlling the pitch of audio.
/// </summary>
/// <value>The value indicating whether or not AudioPitch is enabled. The default is false.</value>
/// <remarks>This function is used for audio content only.
/// To set, the player must be in the <see cref="PlayerState.Idle"/> state.
/// This function could be unavailable depending on the audio codec type.</remarks>
/// <exception cref="InvalidOperationException">
/// The player is not in the valid state.
/// </exception>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="NotAvailableException">If audio offload is enabled by calling <see cref="AudioOffload.IsEnabled"/>. (Since tizen 6.0)
/// -or-<br/>
/// The function is not available depending on the audio codec type. (Since tizen 6.0)
/// </exception>
/// <seealso cref="AudioPitch"/>
/// <seealso cref="AudioOffload"/>
/// <seealso cref="AudioCodecType"/>
/// <since_tizen> 6 </since_tizen>
public bool AudioPitchEnabled
{
get
{
ValidateNotDisposed();
AudioOffload.CheckDisabled();
NativePlayer.IsAudioPitchEnabled(Handle, out var value).
ThrowIfFailed(this, "Failed to get whether the audio pitch is enabled or not");
return value;
}
set
{
ValidateNotDisposed();
AudioOffload.CheckDisabled();
ValidatePlayerState(PlayerState.Idle);
NativePlayer.SetAudioPitchEnabled(Handle, value).
ThrowIfFailed(this, "Failed to enable the audio pitch of the player");
}
}
/// <summary>
/// Gets or sets the pitch of audio.
/// </summary>
/// <value>The audio stream pitch value. The default is 1.</value>
/// <remarks>Enabling pitch control could increase the CPU usage on some devices.
/// This function is used for audio content only.
/// This function could be unavailable depending on the audio codec type.</remarks>
/// <exception cref="InvalidOperationException">
/// A pitch is not enabled.
/// </exception>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// value is less than 0.5.
/// -or-<br/>
/// value is greater than 2.0.
/// </exception>
/// <exception cref="NotAvailableException">If audio offload is enabled by calling <see cref="AudioOffload.IsEnabled"/>. (Since tizen 6.0)
/// -or-<br/>
/// The function is not available depending on the audio codec type. (Since tizen 6.0)
/// </exception>
/// <seealso cref="AudioPitchEnabled"/>
/// <seealso cref="AudioOffload"/>
/// <seealso cref="AudioCodecType"/>
/// <since_tizen> 6 </since_tizen>
public float AudioPitch
{
get
{
ValidateNotDisposed();
AudioOffload.CheckDisabled();
if (AudioPitchEnabled == false)
{
throw new InvalidOperationException("An audio pitch is not enabled.");
}
NativePlayer.GetAudioPitch(Handle, out var value).
ThrowIfFailed(this, "Failed to get the audio pitch");
return value;
}
set
{
ValidateNotDisposed();
AudioOffload.CheckDisabled();
if (AudioPitchEnabled == false)
{
throw new InvalidOperationException("An audio pitch is not enabled.");
}
if (value < 0.5F || 2.0F < value)
{
throw new ArgumentOutOfRangeException(nameof(value), value, "Valid value is 0.5 to 2.0");
}
NativePlayer.SetAudioPitch(Handle, value).ThrowIfFailed(this, "Failed to set the audio pitch");
}
}
/// <summary>
/// Gets or sets the default codec type of the audio decoder.
/// </summary>
/// <value>A <see cref="CodecType"/> specifies the type.
/// The default codec type could be different depending on the device capability.</value>
/// <remarks>
/// <para>To set, the player must be in the <see cref="PlayerState.Idle"/> state.</para>
/// <para>If H/W audio codec type is not supported in some cases, S/W audio codec type could be used instead.</para>
/// <para>The availability could be changed depending on the codec capability.
/// If an application wants to use the H/W audio codec type as default,
/// The following functions should be called after the codec type is set. :<br/>
/// <see cref="AudioEffect.IsAvailable"/><br/>
/// <see cref="EnableExportingAudioData"/><br/>
/// <see cref="DisableExportingAudioData"/><br/>
/// <see cref="ReplayGain"/><br/>
/// <see cref="AudioPitch"/><br/>
/// <see cref="AudioPitchEnabled"/><br/></para>
/// </remarks>
/// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
/// <exception cref="ArgumentException">The value is not valid.</exception>
/// <exception cref="InvalidOperationException">
/// The player is not in the valid state.
/// -or-<br/>
/// Operation failed; internal error.
/// </exception>
/// <exception cref="CodecNotSupportedException">The selected codec is not supported.</exception>
/// <since_tizen> 6 </since_tizen>
public CodecType AudioCodecType
{
get
{
ValidateNotDisposed();
NativePlayer.GetAudioCodecType(Handle, out var value).
ThrowIfFailed(this, "Failed to get the type of the audio codec");
return value;
}
set
{
ValidateNotDisposed();
ValidatePlayerState(PlayerState.Idle);
ValidationUtil.ValidateEnum(typeof(CodecType), value, nameof(value));
NativePlayer.SetAudioCodecType(Handle, value).
ThrowIfFailed(this, "Failed to set the type of the audio codec");
}
}
private SphericalVideo _sphericalVideo;
/// <summary>
/// Gets the spherical video settings.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public SphericalVideo SphericalVideo
{
get
{
if (_sphericalVideo == null)
{
_sphericalVideo = new SphericalVideo(this);
}
return _sphericalVideo;
}
}
private AdaptiveVariants _adaptiveVariants;
/// <summary>
/// Gets the adaptive variants settings.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public AdaptiveVariants AdaptiveVariants
{
get
{
if (_adaptiveVariants == null)
{
_adaptiveVariants = new AdaptiveVariants(this);
}
return _adaptiveVariants;
}
}
private AudioOffload _audioOffload;
/// <summary>
/// Gets the setting for audio offload.
/// </summary>
/// <since_tizen> 6 </since_tizen>
public AudioOffload AudioOffload
{
get
{
if (_audioOffload == null)
{
_audioOffload = new AudioOffload(this);
}
return _audioOffload;
}
}
}
}