• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Media Error Codes
2
3> **NOTE**
4>
5> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](../errorcode-universal.md).
6
7## DTS2025010983858
8
9### quetsion one
10Test DTS2025010983858 quesiton one
11
121. list-One
13   according UserAgent {OSName} and {OSVersion} recognise OpenHarmonyOS.The format: OpenHarmony + Vesion
14
15   ```ts
16   const matches = navigator.userAgent.match(/OpenHarmony (\d+\.?\d*)/);
17   matches?.length && Number(matches[1]) >= 5;
18   ```
19
202. list-Two
21    according UserAgent {OSName} recognise OpenHarmonyOS.
22
23   ```ts
24   const isOpenHarmony = () => /OpenHarmony/i.test(navigator.userAgent);
25   ```
26
27### question two
28
29For exampl:
30
31```ts
32import { taskpool } from '@kit.ArkTS';
33
34@Concurrent
35async function testPromiseError() {
36  await new Promise<number>((resolve, reject) => {
37    resolve(1);
38  }).then(()=>{
39    throw new Error('testPromise Error');
40  })
41}
42
43@Concurrent
44async function testPromiseError1() {
45  await new Promise<string>((resolve, reject) => {
46    reject('testPromiseError1 Error msg');
47  })
48}
49
50@Concurrent
51function testPromiseError2() {
52  return new Promise<string>((resolve, reject) => {
53    reject('testPromiseError2 Error msg');
54  })
55}
56
57async function testConcurrentFunc() {
58  let task1: taskpool.Task = new taskpool.Task(testPromiseError);
59  let task2: taskpool.Task = new taskpool.Task(testPromiseError1);
60  let task3: taskpool.Task = new taskpool.Task(testPromiseError2);
61
62  taskpool.execute(task1).then((d:object)=>{
63    console.info('task1 res is: ' + d);
64  }).catch((e:object)=>{
65    console.info('task1 catch e: ' + e);
66  })
67  taskpool.execute(task2).then((d:object)=>{
68    console.info('task2 res is: ' + d);
69  }).catch((e:object)=>{
70    console.info('task2 catch e: ' + e);
71  })
72  taskpool.execute(task3).then((d:object)=>{
73    console.info('task3 res is: ' + d);
74  }).catch((e:object)=>{
75    console.info('task3 catch e: ' + e);
76  })
77}
78
79@Entry
80@Component
81struct Index {
82  @State message: string = 'Hello World';
83
84  build() {
85    Row() {
86      Column() {
87        Button(this.message)
88          .fontSize(50)
89          .fontWeight(FontWeight.Bold)
90          .onClick(() => {
91            testConcurrentFunc();
92          })
93      }
94      .width('100%')
95    }
96    .height('100%')
97  }
98}
99```
100<!--@[concurrent_taskpool_async_promise_usage](https://gitee.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/TaskPoolIntroduction/entry/src/main/ets/managers/asynchronousfunctions.ets)-->
101
102Test DTS2025010983858 quesiton two
103
104**Table 1**
105|Name|age|city|
106|---|---|---|
107| <!--DelRow-->formVisibleNotify | 15 | beijing |
108| <!--DelRow-->transparencyEnabled | 18| shagnhai |
109|fontScaleFollowSystem|20|London|
110
111**Table 2**
112|Name|age|city|
113|---|---|---|
114|fontScaleFollowSystem|20|London|
115| <!--DelRow-->formVisibleNotify | 15 | beijing |
116| <!--DelRow-->transparencyEnabled | 18| shagnhai |
117|fontScaleFollowSystemeternal|25|Pairs|
118
1191. List-One
120    **Table 3**
121    |Name|age|city|
122    |---|---|---|
123    | <!--DelRow-->formVisibleNotify | 15 | beijing |
124    | <!--DelRow-->transparencyEnabled | 18| shagnhai |
125    |fontScaleFollowSystem|20|London|
126
1272. List-One
128    **Table 4**
129    |Name|age|city|
130    |---|---|---|
131    |fontScaleFollowSystem|20|London|
132    | <!--DelRow-->formVisibleNotify | 15 | beijing |
133    | <!--DelRow-->transparencyEnabled | 18| shagnhai |
134    |fontScaleFollowSystemeternal|25|Pairs|
135
1363. List-Three
137    * ul-list-1
138        **Table 5**
139        |Name|age|city|
140        |---|---|---|
141        | <!--DelRow-->formVisibleNotify | 15 | beijing |
142        | <!--DelRow-->transparencyEnabled | 18| shagnhai |
143        |fontScaleFollowSystem|20|London|
144
145    * ul-list-2
146        **Table 6**
147        |Name|age|city|
148        |---|---|---|
149        |fontScaleFollowSystem|20|London|
150        | <!--DelRow-->formVisibleNotify | 15 | beijing |
151        | <!--DelRow-->transparencyEnabled | 18| shagnhai |
152        |fontScaleFollowSystemeternal|25|Pairs|
153
1544. List-Four
155    ```ts
156    export function testAdd(arg: number) {
157        return ++arg;
158    }
159
160    @Sendable
161    export class MyTestA {
162        constructor(name: string) {
163            this.name = name;
164        }
165        name: string = 'MyTestA';
166    }
167
168    export class MyTestB {
169        static nameStr:string = 'MyTestB';
170    }
171    ```
172    <!--@[concurrent_taskpool_test_resources](https://gitee.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/TaskPoolIntroduction/entry/src/main/ets/managers/Test.ets)-->
173
174
175## 5400101 Memory Allocation Failed
176
177**Error Message**
178
179No memory.
180
181**Description**
182
183Failed to allocate memory.
184
185**Possible Causes**
186
1871. The number of instances exceeds 16.
1882. The new or malloc process fails, causing a null pointer.
189
190**Solution**
191
192Destroy this instance and re-create it. If the re-creation fails, stop related operations.
193
194## 5400102 Unsupported Operation
195
196**Error Message**
197
198Operation not allowed.
199
200**Description**
201
202This operation is not allowed.
203
204**Possible Causes**
205
206This operation is not allowed in the current state.
207
208**Solution**
209
210Switch the instance to the correct state and perform the operation.
211
212## 5400103 I/O Error
213
214**Error Message**
215
216I/O error.
217
218**Description**
219
220An I/O error occurs.
221
222**Possible Causes**
223
224The data interaction between the media and other modules (graphics, audio, network, HDI, and camera) is abnormal.
225
226**Solution**
227
228Ensure that the network is normal, destroy this instance, and re-create it. If the re-creation fails, stop related operations.
229
230## 5400104 Operation Timeout
231
232**Error Message**
233
234Operation timeout.
235
236**Description**
237
238The operation timed out.
239
240**Possible Causes**
241
2421. The network connection times out. (The default network timeout period is 15 seconds, and the timer starts after the buffered event is reported.)
2432. Accessing other modules times out.
244
245**Solution**
246
2471. Check whether the network is normal.
2482. Destroy this instance and re-create it. If the re-creation fails, stop related operations.
249
250## 5400105 Play Service Dead
251
252**Error Message**
253
254Service died.
255
256**Description**
257
258The playback service is dead.
259
260**Possible Causes**
261
262The playback service is dead.
263
264**Solution**
265
266Destroy this instance and re-create it. If the re-creation fails, stop related operations.
267
268## 5400106 Format Not Supported
269
270**Error Message**
271
272Unsupported format.
273
274**Description**
275
276The format is not supported.
277
278**Possible Causes**
279
280The file format is not supported.
281
282**Solution**
283
284Use a supported format.
285
286## 5400107 Audio Focus Conflict
287
288**Error Message**
289
290Audio interrupted.
291
292**Description**
293
294Recording fails due to audio focus conflicts.
295
296**Possible Causes**
297
298Another process occupies the audio focus.
299
300**Solution**
301
302Destroy the current instance and check whether another process is recording. If you can stop the other process, you can create the current instance again.
303
304### test
305
306#### codehub
307
308For example:
309
310```ts
311import { taskpool } from '@kit.ArkTS';
312
313@Concurrent
314function add(num1: number, num2: number): number {
315  return num1 + num2;
316}
317
318async function ConcurrentFunc(): Promise<void> {
319  try {
320    let task: taskpool.Task = new taskpool.Task(add, 1, 2);
321    console.info("taskpool res is: " + await taskpool.execute(task));
322  } catch (e) {
323    console.error("taskpool execute error is: " + e);
324  }
325}
326
327@Entry
328@Component
329struct Index {
330  @State message: string = 'Hello World'
331
332  build() {
333    Row() {
334      Column() {
335        Text(this.message)
336          .fontSize(50)
337          .fontWeight(FontWeight.Bold)
338          .onClick(() => {
339            ConcurrentFunc();
340          })
341      }
342      .width('100%')
343    }
344    .height('100%')
345  }
346}
347```
348<!--@[concurrent_taskpool_common_usage](https://gitee.com/openharmony/applications_app_samples/blob/master/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/TaskPoolIntroduction/entry/src/main/ets/managers/generaluse.ets)-->
349