1# Interface (NativeMediaPlayerHandler) 2 3Implements a **NativeMediaPlayerHandler** object used as a parameter of the [CreateNativeMediaPlayerCallback](./arkts-apis-webview-t.md#createnativemediaplayercallback12) callback. 4The application uses this object to report the player status to the ArkWeb engine. 5 6> **NOTE** 7> 8> - The initial APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. 9> 10> - The initial APIs of this interface are supported since API version 12. 11> 12> - You can preview how this component looks on a real device, but not in DevEco Studio Previewer. 13 14## handleStatusChanged<sup>12+<sup> 15 16handleStatusChanged(status: PlaybackStatus): void 17 18Called to notify the ArkWeb engine of the playback status of the player when the playback status changes. 19 20**System capability**: SystemCapability.Web.Webview.Core 21 22**Parameters** 23 24| Name| Type| Mandatory| Description| 25|--------|------|------|------| 26| status | [PlaybackStatus](./arkts-apis-webview-e.md#playbackstatus12) | Yes| Player status.| 27 28**Example** 29 30For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 31 32## handleVolumeChanged<sup>12+<sup> 33 34handleVolumeChanged(volume: number): void 35 36Called to notify the ArkWeb engine of the volume of the player when the volume changes. 37 38**System capability**: SystemCapability.Web.Webview.Core 39 40**Parameters** 41 42| Name| Type| Mandatory| Description| 43|--------|------|------|------| 44| volume | number | Yes| Volume of the player.| 45 46**Example** 47 48For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 49 50## handleMutedChanged<sup>12+<sup> 51 52handleMutedChanged(muted: boolean): void 53 54Called to notify the ArkWeb engine of the muted status of the player when the muted status changes. 55 56**System capability**: SystemCapability.Web.Webview.Core 57 58**Parameters** 59 60| Name| Type| Mandatory| Description| 61|--------|------|------|------| 62| muted | boolean | Yes| Whether the player is muted.<br>The value **true** indicates that the player is muted, and **false** indicates the opposite.| 63 64**Example** 65 66For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 67 68## handlePlaybackRateChanged<sup>12+<sup> 69 70handlePlaybackRateChanged(playbackRate: number): void 71 72Called to notify the ArkWeb engine of the playback rate of the player when the playback rate changes. 73 74**System capability**: SystemCapability.Web.Webview.Core 75 76**Parameters** 77 78| Name| Type| Mandatory| Description| 79|--------|------|------|------| 80| playbackRate | number | Yes| Playback rate.| 81 82**Example** 83 84For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 85 86## handleDurationChanged<sup>12+<sup> 87 88handleDurationChanged(duration: number): void 89 90Called to notify the ArkWeb engine of the total duration of the media. 91 92**System capability**: SystemCapability.Web.Webview.Core 93 94**Parameters** 95 96| Name| Type| Mandatory| Description| 97|--------|------|------|------| 98| duration | number | Yes| Total duration of the media.<br>Unit: second| 99 100**Example** 101 102For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 103 104## handleTimeUpdate<sup>12+<sup> 105 106handleTimeUpdate(currentPlayTime: number): void 107 108Called to notify the ArkWeb engine of the playback progress when the playback progress changes. 109 110**System capability**: SystemCapability.Web.Webview.Core 111 112**Parameters** 113 114| Name| Type| Mandatory| Description| 115|--------|------|------|------| 116| currentPlayTime | number | Yes| Current progress. Unit: second. | 117 118**Example** 119 120For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 121 122## handleBufferedEndTimeChanged<sup>12+<sup> 123 124handleBufferedEndTimeChanged(bufferedEndTime: number): void 125 126Called to notify the ArkWeb engine of the buffer time when the buffer time changes. 127 128**System capability**: SystemCapability.Web.Webview.Core 129 130**Parameters** 131 132| Name| Type| Mandatory| Description| 133|--------|------|------|------| 134| bufferedEndTime | number | Yes| Duration of media data in the buffer.| 135 136**Example** 137 138For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 139 140## handleEnded<sup>12+<sup> 141 142handleEnded(): void 143 144Called to notify the ArkWeb engine that the media playback ends. 145 146**System capability**: SystemCapability.Web.Webview.Core 147 148**Example** 149 150For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 151 152## handleNetworkStateChanged<sup>12+<sup> 153 154handleNetworkStateChanged(state: NetworkState): void 155 156Called to notify the ArkWeb engine of the network status of the player when the network status changes. 157 158**System capability**: SystemCapability.Web.Webview.Core 159 160**Parameters** 161 162| Name| Type| Mandatory| Description| 163|--------|------|------|------| 164| state | [NetworkState](./arkts-apis-webview-e.md#networkstate12) | Yes| Network status of the player.| 165 166**Example** 167 168For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 169 170## handleReadyStateChanged<sup>12+<sup> 171 172handleReadyStateChanged(state: ReadyState): void 173 174Called to notify the ArkWeb engine of the cache status of the player when the cache status changes. 175 176**System capability**: SystemCapability.Web.Webview.Core 177 178**Parameters** 179 180| Name| Type| Mandatory| Description| 181|--------|------|------|------| 182| state | [ReadyState](./arkts-apis-webview-e.md#readystate12) | Yes| Cache status of the player.| 183 184**Example** 185 186For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 187 188## handleFullscreenChanged<sup>12+<sup> 189 190handleFullscreenChanged(fullscreen: boolean): void 191 192Called to notify the ArkWeb engine of the full screen status of the player when the full screen status changes. 193 194**System capability**: SystemCapability.Web.Webview.Core 195 196**Parameters** 197 198| Name| Type| Mandatory| Description| 199|--------|------|------|------| 200| fullscreen | boolean | Yes| Whether the player is in full screen.<br>The value **true** means that the player is in full screen, and **false** means the opposite.| 201 202**Example** 203 204For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 205 206## handleSeeking<sup>12+<sup> 207 208handleSeeking(): void 209 210Called to notify the ArkWeb engine that the player enters the seek state. 211 212**System capability**: SystemCapability.Web.Webview.Core 213 214**Example** 215 216For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 217 218## handleSeekFinished<sup>12+<sup> 219 220handleSeekFinished(): void 221 222Called to notify the ArkWeb engine that the seek operation is complete. 223 224**System capability**: SystemCapability.Web.Webview.Core 225 226**Example** 227 228For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 229 230## handleError<sup>12+<sup> 231 232handleError(error: MediaError, errorMessage: string): void 233 234Called to notify the ArkWeb engine that an error occurs with the player. 235 236**System capability**: SystemCapability.Web.Webview.Core 237 238**Parameters** 239 240| Name| Type| Mandatory| Description| 241|--------|------|------|------| 242| error | [MediaError](./arkts-apis-webview-e.md#mediaerror12) | Yes| Error object type.| 243| errorMessage | string | Yes| Error message.| 244 245**Example** 246 247For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 248 249## handleVideoSizeChanged<sup>12+<sup> 250 251handleVideoSizeChanged(width: number, height: number): void 252 253Called to notify the ArkWeb engine of the video size of the player. 254 255**System capability**: SystemCapability.Web.Webview.Core 256 257**Parameters** 258 259| Name| Type| Mandatory| Description| 260|--------|------|------|------| 261| width | number | Yes| Video width.| 262| height | number | Yes| Video height.| 263 264**Example** 265 266For details about the sample code, see [onCreateNativeMediaPlayer](./arkts-apis-webview-WebviewController.md#oncreatenativemediaplayer12). 267