Skip to content

Commit 99f2516

Browse files
authored
Merge pull request #2293 from hsgwon/api14.wavplayer.newDocs
[WavPlayer] Split WavPlayer/TonePlayer from MediaPlayback
2 parents 3c6bf8a + ba7d529 commit 99f2516

File tree

3 files changed

+103
-79
lines changed

3 files changed

+103
-79
lines changed

docs/application/dotnet/guides/multimedia/media-playback.md

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ The main media playback features are described below:
2121

2222
Enables you to set specific URLs for [streaming media playback](#stream).
2323

24-
- Using the WAV player
25-
26-
Enables you to play audio in the [WAVE format](#wav).
27-
28-
- Using the tone player
29-
30-
Enables you to play [tones](#tone).
31-
3224
Before you start, [set up the player](#prepare).
3325

3426
<a name="audio"></a>
@@ -146,21 +138,6 @@ The following table lists the streaming protocol features supported by the playe
146138
| Hypertext Transfer Protocol (HTTP) | HTTP progressive download play |
147139
| Real Time Streaming Protocol (RTSP) | RTSP streaming |
148140

149-
<a name="wav"></a>
150-
## WAV player
151-
152-
The [Tizen.Multimedia.WavPlayer](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.WavPlayer.html) class allows you to play audio resources (media files stored on the device). Use it to [play audio and control playback](#start_wav). You can use the WAV and OGG audio formats.
153-
154-
Multiple instances of the WAV player can be used to play several audio data streams concurrently. This means that your application can play multiple uncompressed audio files, such as WAV, at the same time.
155-
156-
<a name="tone"></a>
157-
## Tone player
158-
159-
You can play a tone or a list of tones using the [Tizen.Multimedia.TonePlayer](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.TonePlayer.html) class.
160-
161-
To play tones, use a DTMF (Dual Tone Multi Frequency) preset frequency. The possible values are defined in the [Tizen.Multimedia.ToneType](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.ToneType.html) enumeration.
162-
163-
You can [start and stop playing a tone](#play_tone), and [play a tone for a specified duration](#duration).
164141

165142
## Prerequisites
166143

@@ -409,60 +386,6 @@ To insert subtitles to a video file, set the subtitle path using the `SetSubtitl
409386
player.SetSubtitle(subtitlePath);
410387
```
411388

412-
<a name="start_wav"></a>
413-
## Start and stop the WAV player
414-
415-
To start and stop the WAV player, proceed as follows:
416-
417-
1. To play a WAV file, use the `StartAsync()` method of the [Tizen.Multimedia.WavPlayer](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.WavPlayer.html) class:
418-
419-
```csharp
420-
await WavPlayer.StartAsync(wavPath, new AudioStreamPolicy(AudioStreamType.Media));
421-
```
422-
423-
To set the path of your WAV file, you potentially need to retrieve the default path for audio files.
424-
425-
2. To stop the WAV player, use the `StartAsync()` method with the `cancellationToken` parameter:
426-
427-
```csharp
428-
var cancellationTokenSource = new CancellationTokenSource();
429-
430-
WavPlayer.StartAsync(wavPath, new AudioStreamPolicy(AudioStreamType.Media), cancellationTokenSource);
431-
432-
cancellationTokenSource.Cancel();
433-
```
434-
435-
<a name="play_tone"></a>
436-
## Playing a tone
437-
438-
To start and stop playing a tone, proceed as follows:
439-
440-
1. To start playback, use the `StartAsync()` method of the [Tizen.Multimedia.TonePlayer](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.TonePlayer.html) class.
441-
442-
The first parameter defines the tone type as a value of the [Tizen.Multimedia.ToneType](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.ToneType.html) enumeration:
443-
444-
```csharp
445-
await TonePlayer.StartAsync(ToneType.Default, new AudioStreamPolicy(AudioStreamType.Media), -1);
446-
```
447-
448-
2. To stop playback, use the `StartAsync()` method with the `cancellationToken` parameter:
449-
450-
```csharp
451-
var cancellationTokenSource = new CancellationTokenSource();
452-
453-
TonePlayer.StartAsync(ToneType.Default, new AudioStreamPolicy(AudioStreamType.Media), -1, cancellationTokenSource);
454-
455-
cancellationTokenSource.Cancel();
456-
```
457-
458-
<a name="duration"></a>
459-
## Playing a tone for a specified duration
460-
461-
To play a tone for a specified duration, use the `StartAsync()` method of the [Tizen.Multimedia.TonePlayer](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.TonePlayer.html) class with the duration parameter (the number of milliseconds you want playback to last). When you set the duration to a specified time, playback stops automatically after that time:
462-
463-
```csharp
464-
await TonePlayer.StartAsync(ToneType.Default, new AudioStreamPolicy(AudioStreamType.Media), duration);
465-
```
466389

467390

468391
## Related information

docs/application/dotnet/guides/multimedia/overview.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ You can use the following multimedia features in your .NET applications:
3131

3232
- [Media Playback](media-playback.md)
3333

34-
You can manage the playback of different media file types. You can play audio and video files, and tones. You can also manage the state of the media player.
34+
You can manage the playback of different media file types. You can play audio and video files. You can also manage the state of the media player.
35+
36+
- [WAV and Tone Player](wav-tone-player.md)
37+
38+
You can play wav files and tones. This section provides detailed information on how to use the wav player and tone player.
3539

3640
- [Media Recording](media-recording.md)
3741

@@ -82,4 +86,4 @@ You can use the following multimedia features in your .NET applications:
8286
- [Tizen.Multimedia.Util](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.Util.html) namespace
8387
- APIs for ImageUtil, ThumbnailExtractor
8488
- [Tizen.Multimedia.Vision](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.Vision.html) namespace
85-
- APIs for MediaVision
89+
- APIs for MediaVision
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Media Playback
2+
3+
You can play different audio formats.
4+
5+
The main media playback features are described below:
6+
7+
- Using the WAV player
8+
9+
Enables you to play audio in the [WAVE format](#wav).
10+
11+
- Using the tone player
12+
13+
Enables you to play [tones](#tone).
14+
15+
<a name="wav"></a>
16+
## WAV player
17+
18+
The [Tizen.Multimedia.WavPlayer](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.WavPlayer.html) class allows you to play audio resources (media files stored on the device). Use it to [play audio and control playback](#start_wav). You can use the WAV and OGG audio formats.
19+
20+
Multiple instances of the WAV player can be used to play several audio data streams concurrently. This means that your application can play multiple uncompressed audio files, such as WAV, at the same time.
21+
22+
<a name="tone"></a>
23+
## Tone player
24+
25+
You can play a tone or a list of tones using the [Tizen.Multimedia.TonePlayer](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.TonePlayer.html) class.
26+
27+
To play tones, use a DTMF (Dual Tone Multi Frequency) preset frequency. The possible values are defined in the [Tizen.Multimedia.ToneType](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.ToneType.html) enumeration.
28+
29+
You can [start and stop playing a tone](#play_tone), and [play a tone for a specified duration](#duration).
30+
31+
## Prerequisites
32+
33+
To use the methods and properties of the media playback classes, include the [Tizen.Multimedia](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.html) namespace in your application:
34+
35+
```csharp
36+
using Tizen.Multimedia;
37+
```
38+
39+
40+
<a name="start_wav"></a>
41+
## Start and stop the WAV player
42+
43+
To start and stop the WAV player, proceed as follows:
44+
45+
1. To play a WAV file, use the `StartAsync()` method of the [Tizen.Multimedia.WavPlayer](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.WavPlayer.html) class:
46+
47+
```csharp
48+
await WavPlayer.StartAsync(wavPath, new AudioStreamPolicy(AudioStreamType.Media));
49+
```
50+
51+
To set the path of your WAV file, you potentially need to retrieve the default path for audio files.
52+
53+
2. To stop the WAV player, use the `StartAsync()` method with the `cancellationToken` parameter:
54+
55+
```csharp
56+
var cancellationTokenSource = new CancellationTokenSource();
57+
58+
WavPlayer.StartAsync(wavPath, new AudioStreamPolicy(AudioStreamType.Media), cancellationTokenSource);
59+
60+
cancellationTokenSource.Cancel();
61+
```
62+
63+
<a name="play_tone"></a>
64+
## Playing a tone
65+
66+
To start and stop playing a tone, proceed as follows:
67+
68+
1. To start playback, use the `StartAsync()` method of the [Tizen.Multimedia.TonePlayer](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.TonePlayer.html) class.
69+
70+
The first parameter defines the tone type as a value of the [Tizen.Multimedia.ToneType](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.ToneType.html) enumeration:
71+
72+
```csharp
73+
await TonePlayer.StartAsync(ToneType.Default, new AudioStreamPolicy(AudioStreamType.Media), -1);
74+
```
75+
76+
2. To stop playback, use the `StartAsync()` method with the `cancellationToken` parameter:
77+
78+
```csharp
79+
var cancellationTokenSource = new CancellationTokenSource();
80+
81+
TonePlayer.StartAsync(ToneType.Default, new AudioStreamPolicy(AudioStreamType.Media), -1, cancellationTokenSource);
82+
83+
cancellationTokenSource.Cancel();
84+
```
85+
86+
<a name="duration"></a>
87+
## Playing a tone for a specified duration
88+
89+
To play a tone for a specified duration, use the `StartAsync()` method of the [Tizen.Multimedia.TonePlayer](/application/dotnet/api/TizenFX/latest/api/Tizen.Multimedia.TonePlayer.html) class with the duration parameter (the number of milliseconds you want playback to last). When you set the duration to a specified time, playback stops automatically after that time:
90+
91+
```csharp
92+
await TonePlayer.StartAsync(ToneType.Default, new AudioStreamPolicy(AudioStreamType.Media), duration);
93+
```
94+
95+
## Related information
96+
* Dependencies
97+
- Tizen 4.0 and Higher

0 commit comments

Comments
 (0)