1{ 2 "methods": { 3 "__constructor__()": { 4 "isImplementation": true, 5 "modifiers": [ 6 "protected" 7 ], 8 "params": [], 9 "returnType": "void", 10 "exceptions": [], 11 "name": "__constructor__()" 12 }, 13 "__staticInitializer__()": { 14 "isImplementation": true, 15 "modifiers": [ 16 "protected", 17 "static" 18 ], 19 "params": [], 20 "returnType": "void", 21 "exceptions": [], 22 "name": "__staticInitializer__()" 23 }, 24 "_pause()": { 25 "isImplementation": true, 26 "modifiers": [ 27 "protected" 28 ], 29 "params": [], 30 "returnType": "void", 31 "exceptions": [], 32 "name": "_pause()", 33 "documentation": "Simulates {@link MediaPlayer#_pause()}. Invokes {@link #doStop()} to suspend playback event\ncallbacks and sets the state to PAUSED.\n\n@see #doStop()\n" 34 }, 35 "_release()": { 36 "isImplementation": true, 37 "modifiers": [ 38 "protected" 39 ], 40 "params": [], 41 "returnType": "void", 42 "exceptions": [], 43 "name": "_release()", 44 "documentation": "Simulates call to {@link MediaPlayer#_release()}. Calls {@link #doStop()} to suspend playback\nevent callbacks and sets the state to END.\n" 45 }, 46 "_reset()": { 47 "isImplementation": true, 48 "modifiers": [ 49 "protected" 50 ], 51 "params": [], 52 "returnType": "void", 53 "exceptions": [], 54 "name": "_reset()", 55 "documentation": "Simulates call to {@link MediaPlayer#_reset()}. Calls {@link #doStop()} to suspend playback\nevent callbacks and sets the state to IDLE.\n" 56 }, 57 "_stop()": { 58 "isImplementation": true, 59 "modifiers": [ 60 "protected" 61 ], 62 "params": [], 63 "returnType": "void", 64 "exceptions": [], 65 "name": "_stop()", 66 "documentation": "Simulates call to {@link MediaPlayer#release()}. Calls {@link #doStop()} to suspend playback\nevent callbacks and sets the state to STOPPED.\n" 67 }, 68 "addException(org.robolectric.shadows.util.DataSource,java.io.IOException)": { 69 "isImplementation": false, 70 "modifiers": [ 71 "public", 72 "static" 73 ], 74 "params": [ 75 "dataSource", 76 "e" 77 ], 78 "returnType": "void", 79 "exceptions": [], 80 "name": "addException(org.robolectric.shadows.util.DataSource,java.io.IOException)" 81 }, 82 "addException(org.robolectric.shadows.util.DataSource,java.lang.RuntimeException)": { 83 "isImplementation": false, 84 "modifiers": [ 85 "public", 86 "static" 87 ], 88 "params": [ 89 "dataSource", 90 "e" 91 ], 92 "returnType": "void", 93 "exceptions": [], 94 "name": "addException(org.robolectric.shadows.util.DataSource,java.lang.RuntimeException)" 95 }, 96 "addMediaInfo(org.robolectric.shadows.util.DataSource,org.robolectric.shadows.ShadowMediaPlayer.MediaInfo)": { 97 "isImplementation": false, 98 "modifiers": [ 99 "public", 100 "static" 101 ], 102 "params": [ 103 "dataSource", 104 "info" 105 ], 106 "returnType": "void", 107 "exceptions": [], 108 "name": "addMediaInfo(org.robolectric.shadows.util.DataSource,org.robolectric.shadows.ShadowMediaPlayer.MediaInfo)" 109 }, 110 "attachAuxEffect(int)": { 111 "isImplementation": true, 112 "modifiers": [ 113 "protected" 114 ], 115 "params": [ 116 "effectId" 117 ], 118 "returnType": "void", 119 "exceptions": [], 120 "name": "attachAuxEffect(int)" 121 }, 122 "checkStateError(java.lang.String,java.util.EnumSet\u003corg.robolectric.shadows.ShadowMediaPlayer.State\u003e)": { 123 "isImplementation": false, 124 "modifiers": [ 125 "private" 126 ], 127 "params": [ 128 "method", 129 "allowedStates" 130 ], 131 "returnType": "boolean", 132 "exceptions": [], 133 "name": "checkStateError(java.lang.String,java.util.EnumSet\u003corg.robolectric.shadows.ShadowMediaPlayer.State\u003e)", 134 "documentation": "Checks states for methods that asynchronously invoke\n{@link android.media.MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int)\nonError()} when invoked in an illegal state. Such methods always throw\n{@link IllegalStateException} rather than invoke {@code onError()} if\nthey are invoked from the END state.\n\nThis method will either emulate this behavior by posting an\n{@code onError()} callback to the current thread\u0027s message queue (or\nthrow an {@link IllegalStateException} if invoked from the END state), or\nelse it will generate an assertion if {@link #setAssertOnError\nassertOnError} is set.\n\n@param method\n the name of the method being tested.\n@param allowedStates\n the states that this method is allowed to be called from.\n@see #getHandler\n@see #setAssertOnError\n@see #checkStateLog(String, EnumSet)\n@see #checkStateException(String, EnumSet)\n" 135 }, 136 "checkStateException(java.lang.String,java.util.EnumSet\u003corg.robolectric.shadows.ShadowMediaPlayer.State\u003e)": { 137 "isImplementation": false, 138 "modifiers": [ 139 "private" 140 ], 141 "params": [ 142 "method", 143 "allowedStates" 144 ], 145 "returnType": "void", 146 "exceptions": [], 147 "name": "checkStateException(java.lang.String,java.util.EnumSet\u003corg.robolectric.shadows.ShadowMediaPlayer.State\u003e)", 148 "documentation": "Checks states for methods that synchronously throw an exception when\ninvoked in an illegal state. This method will likewise throw an\n{@link IllegalArgumentException} if it determines that the method has been\ninvoked from a disallowed state, or else it will generate an assertion if\n{@link #setAssertOnError assertOnError} is set.\n\n@param method\n the name of the method being tested.\n@param allowedStates\n the states that this method is allowed to be called from.\n@see #setAssertOnError\n@see #checkStateLog(String, EnumSet)\n@see #checkStateError(String, EnumSet)\n" 149 }, 150 "checkStateLog(java.lang.String,java.util.EnumSet\u003corg.robolectric.shadows.ShadowMediaPlayer.State\u003e)": { 151 "isImplementation": false, 152 "modifiers": [ 153 "private" 154 ], 155 "params": [ 156 "method", 157 "allowedStates" 158 ], 159 "returnType": "void", 160 "exceptions": [], 161 "name": "checkStateLog(java.lang.String,java.util.EnumSet\u003corg.robolectric.shadows.ShadowMediaPlayer.State\u003e)", 162 "documentation": "Checks states for methods that only log when there is an error. Such\nmethods throw an {@link IllegalArgumentException} when invoked in the END\nstate, but log an error in other disallowed states. This method will either\nemulate this behavior or else will generate an assertion if invoked from a\ndisallowed state if {@link #setAssertOnError assertOnError} is set.\n\n@param method\n the name of the method being tested.\n@param allowedStates\n the states that this method is allowed to be called from.\n@see #setAssertOnError\n@see #checkStateError(String, EnumSet)\n@see #checkStateException(String, EnumSet)\n" 163 }, 164 "create(android.content.Context,android.net.Uri)": { 165 "isImplementation": true, 166 "modifiers": [ 167 "protected", 168 "static" 169 ], 170 "params": [ 171 "context", 172 "uri" 173 ], 174 "returnType": "android.media.MediaPlayer", 175 "exceptions": [], 176 "name": "create(android.content.Context,android.net.Uri)" 177 }, 178 "create(android.content.Context,int)": { 179 "isImplementation": true, 180 "modifiers": [ 181 "protected", 182 "static" 183 ], 184 "params": [ 185 "context", 186 "resId" 187 ], 188 "returnType": "android.media.MediaPlayer", 189 "exceptions": [], 190 "name": "create(android.content.Context,int)" 191 }, 192 "doSetDataSource(org.robolectric.shadows.util.DataSource)": { 193 "isImplementation": false, 194 "modifiers": [ 195 "public" 196 ], 197 "params": [ 198 "dataSource" 199 ], 200 "returnType": "void", 201 "exceptions": [], 202 "name": "doSetDataSource(org.robolectric.shadows.util.DataSource)", 203 "documentation": "Sets the data source without doing any other emulation. Sets the\ninternal data source only.\nCalling directly can be useful for setting up a {@link ShadowMediaPlayer}\ninstance during specific testing so that you don\u0027t have to clutter your\ntests catching exceptions you know won\u0027t be thrown.\n\n@param dataSource the data source that is being set.\n@see #setDataSource(DataSource)\n" 204 }, 205 "doStart()": { 206 "isImplementation": false, 207 "modifiers": [ 208 "public" 209 ], 210 "params": [], 211 "returnType": "void", 212 "exceptions": [], 213 "name": "doStart()", 214 "documentation": "Starts simulated playback. Until this method is called, the player is not\n\"really playing\" (see {@link #isReallyPlaying} for a definition of\n\"really playing\").\n\nThis method is used internally by the various shadow method implementations\nof the MediaPlayer public API, but may also be called directly by the test\nsuite if you wish to simulate an internal pause. For example, to simulate\na buffer underrun (player is in PLAYING state but isn\u0027t actually advancing\nthe current position through the media), you could call {@link #doStop()} to\nmark the start of the buffer underrun and {@link #doStart()} to mark its\nend and restart normal playback (which is what\n{@link ShadowMediaPlayer.MediaInfo#scheduleBufferUnderrunAtOffset(int, int) scheduleBufferUnderrunAtOffset()}\ndoes).\n\n@see #isReallyPlaying()\n@see #doStop()\n" 215 }, 216 "doStop()": { 217 "isImplementation": false, 218 "modifiers": [ 219 "public" 220 ], 221 "params": [], 222 "returnType": "void", 223 "exceptions": [], 224 "name": "doStop()", 225 "documentation": "Pauses simulated playback. After this method is called, the player is no\nlonger \"really playing\" (see {@link #isReallyPlaying} for a definition of\n\"really playing\").\n\nThis method is used internally by the various shadow method implementations\nof the MediaPlayer public API, but may also be called directly by the test\nsuite if you wish to simulate an internal pause.\n\n@see #isReallyPlaying()\n@see #doStart()\n" 226 }, 227 "getAudioSessionId()": { 228 "isImplementation": true, 229 "modifiers": [ 230 "protected" 231 ], 232 "params": [], 233 "returnType": "int", 234 "exceptions": [], 235 "name": "getAudioSessionId()" 236 }, 237 "getAuxEffect()": { 238 "isImplementation": false, 239 "modifiers": [ 240 "public" 241 ], 242 "params": [], 243 "returnType": "int", 244 "exceptions": [], 245 "name": "getAuxEffect()", 246 "documentation": "Useful for assertions.\n\n@return The current {@code auxEffect} setting.\n" 247 }, 248 "getCurrentPosition()": { 249 "isImplementation": true, 250 "modifiers": [ 251 "protected" 252 ], 253 "params": [], 254 "returnType": "int", 255 "exceptions": [], 256 "name": "getCurrentPosition()", 257 "documentation": "Simulates call to {@link MediaPlayer#getCurrentPosition()}. Simply does the state validity\nchecks and then invokes {@link #getCurrentPositionRaw()} to calculate the simulated playback\nposition.\n\n@return The current offset (in ms) of the simulated playback.\n@see #getCurrentPositionRaw()\n" 258 }, 259 "getCurrentPositionRaw()": { 260 "isImplementation": false, 261 "modifiers": [ 262 "public" 263 ], 264 "params": [], 265 "returnType": "int", 266 "exceptions": [], 267 "name": "getCurrentPositionRaw()", 268 "documentation": "Retrieves the current position without doing the state checking that the\nemulated version of {@link #getCurrentPosition()} does.\n\n@return The current playback position within the current clip.\n" 269 }, 270 "getDataSource()": { 271 "isImplementation": false, 272 "modifiers": [ 273 "public" 274 ], 275 "params": [], 276 "returnType": "org.robolectric.shadows.util.DataSource", 277 "exceptions": [], 278 "name": "getDataSource()", 279 "documentation": "Retrieves the data source (if any) that was passed in to\n{@link #setDataSource(DataSource)}.\n\nUseful for assertions.\n\n@return The source passed in to {@code setDataSource}.\n" 280 }, 281 "getDuration()": { 282 "isImplementation": true, 283 "modifiers": [ 284 "protected" 285 ], 286 "params": [], 287 "returnType": "int", 288 "exceptions": [], 289 "name": "getDuration()", 290 "documentation": "Simulates call to {@link MediaPlayer#getDuration()}. Retrieves the duration as defined by the\ncurrent {@link MediaInfo} instance.\n\n@return The duration (in ms) of the current simulated playback.\n@see #addMediaInfo(DataSource, MediaInfo)\n" 291 }, 292 "getDurationRaw()": { 293 "isImplementation": false, 294 "modifiers": [ 295 "public" 296 ], 297 "params": [], 298 "returnType": "int", 299 "exceptions": [], 300 "name": "getDurationRaw()", 301 "documentation": "Retrieves the current duration without doing the state checking that the\nemulated version does.\n\n@return The duration of the current clip loaded by the player.\n" 302 }, 303 "getHandler()": { 304 "isImplementation": false, 305 "modifiers": [ 306 "public" 307 ], 308 "params": [], 309 "returnType": "android.os.Handler", 310 "exceptions": [], 311 "name": "getHandler()", 312 "documentation": "Retrieves the {@link Handler} object used by this\n{@code ShadowMediaPlayer}. Can be used for posting custom asynchronous\nevents to the thread (eg, asynchronous errors). Use this for scheduling\nevents to take place at a particular \"real\" time (ie, time as measured by\nthe scheduler). For scheduling events to occur at a particular playback\noffset (no matter how long playback may be paused for, or where you seek\nto, etc), see {@link MediaInfo#scheduleEventAtOffset(int, ShadowMediaPlayer.MediaEvent)} and\nits various helpers.\n\n@return Handler object that can be used to schedule asynchronous events on\n this media player.\n" 313 }, 314 "getHandler(android.os.Looper)": { 315 "isImplementation": false, 316 "modifiers": [ 317 "private" 318 ], 319 "params": [ 320 "looper" 321 ], 322 "returnType": "android.os.Handler", 323 "exceptions": [], 324 "name": "getHandler(android.os.Looper)" 325 }, 326 "getInvalidStateBehavior()": { 327 "isImplementation": false, 328 "modifiers": [ 329 "public" 330 ], 331 "params": [], 332 "returnType": "org.robolectric.shadows.ShadowMediaPlayer.InvalidStateBehavior", 333 "exceptions": [], 334 "name": "getInvalidStateBehavior()", 335 "documentation": "Retrieves current flag specifying the behavior of the media player when a\nmethod is invoked in an invalid state. See\n{@link #setInvalidStateBehavior(InvalidStateBehavior)} for a discussion of\nthe available modes and their associated behaviors.\n\n@return The current invalid state behavior mode.\n@see #setInvalidStateBehavior\n" 336 }, 337 "getLeftVolume()": { 338 "isImplementation": false, 339 "modifiers": [ 340 "public" 341 ], 342 "params": [], 343 "returnType": "float", 344 "exceptions": [], 345 "name": "getLeftVolume()", 346 "documentation": "Retrieves the current setting for the left channel volume.\n\n@return The left channel volume.\n" 347 }, 348 "getMediaInfo()": { 349 "isImplementation": false, 350 "modifiers": [ 351 "public" 352 ], 353 "params": [], 354 "returnType": "org.robolectric.shadows.ShadowMediaPlayer.MediaInfo", 355 "exceptions": [], 356 "name": "getMediaInfo()", 357 "documentation": "Retrieves the currently selected {@link MediaInfo}. This instance is used\nto define current duration, preparation delay, exceptions for\n{@code setDataSource()}, playback events, etc.\n\n@return The currently selected {@link MediaInfo}.\n@see #addMediaInfo\n@see #doSetDataSource(DataSource)\n" 358 }, 359 "getMediaInfo(org.robolectric.shadows.util.DataSource)": { 360 "isImplementation": false, 361 "modifiers": [ 362 "public", 363 "static" 364 ], 365 "params": [ 366 "dataSource" 367 ], 368 "returnType": "org.robolectric.shadows.ShadowMediaPlayer.MediaInfo", 369 "exceptions": [], 370 "name": "getMediaInfo(org.robolectric.shadows.util.DataSource)" 371 }, 372 "getOnCompletionListener()": { 373 "isImplementation": false, 374 "modifiers": [ 375 "public" 376 ], 377 "params": [], 378 "returnType": "android.media.MediaPlayer.OnCompletionListener", 379 "exceptions": [], 380 "name": "getOnCompletionListener()", 381 "documentation": "@return the OnCompletionListener\n" 382 }, 383 "getOnPreparedListener()": { 384 "isImplementation": false, 385 "modifiers": [ 386 "public" 387 ], 388 "params": [], 389 "returnType": "android.media.MediaPlayer.OnPreparedListener", 390 "exceptions": [], 391 "name": "getOnPreparedListener()", 392 "documentation": "@return the OnPreparedListener\n" 393 }, 394 "getPendingSeek()": { 395 "isImplementation": false, 396 "modifiers": [ 397 "public" 398 ], 399 "params": [], 400 "returnType": "int", 401 "exceptions": [], 402 "name": "getPendingSeek()", 403 "documentation": "Retrieves the pending seek setting.\n\n@return The position to which the shadow player is seeking for the seek in\n progress (ie, after the call to {@link #seekTo} but before a call\n to {@link #invokeSeekCompleteListener()}). Returns {@code -1}\n if no seek is in progress.\n" 404 }, 405 "getRightVolume()": { 406 "isImplementation": false, 407 "modifiers": [ 408 "public" 409 ], 410 "params": [], 411 "returnType": "float", 412 "exceptions": [], 413 "name": "getRightVolume()", 414 "documentation": "@return The right channel volume.\n" 415 }, 416 "getSeekDelay()": { 417 "isImplementation": false, 418 "modifiers": [ 419 "public" 420 ], 421 "params": [], 422 "returnType": "int", 423 "exceptions": [], 424 "name": "getSeekDelay()", 425 "documentation": "@return seekDelay\n" 426 }, 427 "getSourceResId()": { 428 "isImplementation": false, 429 "modifiers": [ 430 "public" 431 ], 432 "params": [], 433 "returnType": "int", 434 "exceptions": [], 435 "name": "getSourceResId()", 436 "documentation": "Retrieves the resource ID used in the call to {@link #create(Context, int)}\n(if any).\n\n@return The resource ID passed in to {@code create()}, or\n {@code -1} if a different method of setting the source was\n used.\n" 437 }, 438 "getSourceUri()": { 439 "isImplementation": false, 440 "modifiers": [ 441 "public" 442 ], 443 "params": [], 444 "returnType": "android.net.Uri", 445 "exceptions": [], 446 "name": "getSourceUri()", 447 "documentation": "Retrieves the source path (if any) that was passed in to\n{@link MediaPlayer#setDataSource(Context, Uri, Map)} or\n{@link MediaPlayer#setDataSource(Context, Uri)}.\n\n@return The source Uri passed in to {@code setDataSource}.\n" 448 }, 449 "getState()": { 450 "isImplementation": false, 451 "modifiers": [ 452 "public" 453 ], 454 "params": [], 455 "returnType": "org.robolectric.shadows.ShadowMediaPlayer.State", 456 "exceptions": [], 457 "name": "getState()", 458 "documentation": "Retrieves the current state of the {@link MediaPlayer}. Uses the states as\ndefined in the {@link MediaPlayer} documentation.\n\n@return The current state of the {@link MediaPlayer}, as defined in the\n MediaPlayer documentation.\n@see #setState\n@see MediaPlayer\n" 459 }, 460 "getTheAudioStreamType()": { 461 "isImplementation": false, 462 "modifiers": [ 463 "public" 464 ], 465 "params": [], 466 "returnType": "int", 467 "exceptions": [], 468 "name": "getTheAudioStreamType()", 469 "documentation": "Note: This has a funny name at the\nmoment to avoid having to produce an API-specific shadow -\nif it were called {@code getAudioStreamType()} then\nthe {@code RobolectricWiringTest} will inform us that\nit should be annotated with {@link Implementation}, because\nthere is a private method in the later API versions with\nthe same name, however this would fail on earlier versions.\n\n@return audioStreamType\n" 470 }, 471 "getVideoHeight()": { 472 "isImplementation": true, 473 "modifiers": [ 474 "protected" 475 ], 476 "params": [], 477 "returnType": "int", 478 "exceptions": [], 479 "name": "getVideoHeight()" 480 }, 481 "getVideoWidth()": { 482 "isImplementation": true, 483 "modifiers": [ 484 "protected" 485 ], 486 "params": [], 487 "returnType": "int", 488 "exceptions": [], 489 "name": "getVideoWidth()" 490 }, 491 "invokeCompletionListener()": { 492 "isImplementation": false, 493 "modifiers": [ 494 "public" 495 ], 496 "params": [], 497 "returnType": "void", 498 "exceptions": [], 499 "name": "invokeCompletionListener()", 500 "documentation": "Simulates end-of-playback. Changes the player into PLAYBACK_COMPLETED state\nand calls\n{@link MediaPlayer.OnCompletionListener#onCompletion(MediaPlayer)\nonCompletion()} if a listener has been set.\n" 501 }, 502 "invokeErrorListener(int,int)": { 503 "isImplementation": false, 504 "modifiers": [ 505 "public" 506 ], 507 "params": [ 508 "what", 509 "extra" 510 ], 511 "returnType": "void", 512 "exceptions": [], 513 "name": "invokeErrorListener(int,int)", 514 "documentation": "Allows test cases to directly simulate invocation of the OnError event.\n\n@param what\n parameter to pass in to {@code what} in\n {@link MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int)}.\n@param extra\n parameter to pass in to {@code extra} in\n {@link MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int)}.\n" 515 }, 516 "invokeInfoListener(int,int)": { 517 "isImplementation": false, 518 "modifiers": [ 519 "public" 520 ], 521 "params": [ 522 "what", 523 "extra" 524 ], 525 "returnType": "void", 526 "exceptions": [], 527 "name": "invokeInfoListener(int,int)", 528 "documentation": "Allows test cases to directly simulate invocation of the OnInfo event.\n\n@param what\n parameter to pass in to {@code what} in\n {@link MediaPlayer.OnInfoListener#onInfo(MediaPlayer, int, int)}.\n@param extra\n parameter to pass in to {@code extra} in\n {@link MediaPlayer.OnInfoListener#onInfo(MediaPlayer, int, int)}.\n" 529 }, 530 "invokePreparedListener()": { 531 "isImplementation": false, 532 "modifiers": [ 533 "public" 534 ], 535 "params": [], 536 "returnType": "void", 537 "exceptions": [], 538 "name": "invokePreparedListener()", 539 "documentation": "Allows test cases to simulate \u0027prepared\u0027 state by invoking callback. Sets\nthe player\u0027s state to PREPARED and invokes the\n{@link MediaPlayer.OnPreparedListener#onPrepared preparedListener()}\n" 540 }, 541 "invokeSeekCompleteListener()": { 542 "isImplementation": false, 543 "modifiers": [ 544 "public" 545 ], 546 "params": [], 547 "returnType": "void", 548 "exceptions": [], 549 "name": "invokeSeekCompleteListener()", 550 "documentation": "Allows test cases to simulate seek completion by invoking callback.\n" 551 }, 552 "isLooping()": { 553 "isImplementation": true, 554 "modifiers": [ 555 "protected" 556 ], 557 "params": [], 558 "returnType": "boolean", 559 "exceptions": [], 560 "name": "isLooping()" 561 }, 562 "isPlaying()": { 563 "isImplementation": true, 564 "modifiers": [ 565 "protected" 566 ], 567 "params": [], 568 "returnType": "boolean", 569 "exceptions": [], 570 "name": "isPlaying()" 571 }, 572 "isPrepared()": { 573 "isImplementation": false, 574 "modifiers": [ 575 "public" 576 ], 577 "params": [], 578 "returnType": "boolean", 579 "exceptions": [], 580 "name": "isPrepared()", 581 "documentation": "Tests to see if the player is in the PREPARED state.\nThis is mainly used for backward compatibility.\n{@link #getState} may be more useful for new testing applications.\n\n@return {@code true} if the MediaPlayer is in the PREPARED state,\n false otherwise.\n" 582 }, 583 "isReallyPlaying()": { 584 "isImplementation": false, 585 "modifiers": [ 586 "public" 587 ], 588 "params": [], 589 "returnType": "boolean", 590 "exceptions": [], 591 "name": "isReallyPlaying()", 592 "documentation": "Tests to see if the player is really playing.\n\nThe player is defined as \"really playing\" if simulated playback events\n(including playback completion) are being scheduled and invoked and\n{@link #getCurrentPosition currentPosition} is being updated as time\npasses. Note that while the player will normally be really playing if in\nthe STARTED state, this is not always the case - for example, if a pending\nseek is in progress, or perhaps a buffer underrun is being simulated.\n\n@return {@code true} if the player is really playing or\n {@code false} if the player is internally paused.\n@see #doStart\n@see #doStop\n" 593 }, 594 "postEvent(org.robolectric.shadows.ShadowMediaPlayer.MediaEvent)": { 595 "isImplementation": false, 596 "modifiers": [ 597 "public" 598 ], 599 "params": [ 600 "e" 601 ], 602 "returnType": "void", 603 "exceptions": [], 604 "name": "postEvent(org.robolectric.shadows.ShadowMediaPlayer.MediaEvent)" 605 }, 606 "postEventDelayed(org.robolectric.shadows.ShadowMediaPlayer.MediaEvent,long)": { 607 "isImplementation": false, 608 "modifiers": [ 609 "public" 610 ], 611 "params": [ 612 "e", 613 "delay" 614 ], 615 "returnType": "void", 616 "exceptions": [], 617 "name": "postEventDelayed(org.robolectric.shadows.ShadowMediaPlayer.MediaEvent,long)" 618 }, 619 "prepare()": { 620 "isImplementation": true, 621 "modifiers": [ 622 "protected" 623 ], 624 "params": [], 625 "returnType": "void", 626 "exceptions": [], 627 "name": "prepare()", 628 "documentation": "Simulates {@link MediaPlayer#prepareAsync()}. Sleeps for {@link MediaInfo#getPreparationDelay()\npreparationDelay} ms by calling {@link SystemClock#sleep(long)} before calling {@link\n#invokePreparedListener()}.\n\n\u003cp\u003eIf {@code preparationDelay} is not positive and non-zero, there is no sleep.\n\n@see MediaInfo#setPreparationDelay(int)\n@see #invokePreparedListener()\n" 629 }, 630 "prepareAsync()": { 631 "isImplementation": true, 632 "modifiers": [ 633 "protected" 634 ], 635 "params": [], 636 "returnType": "void", 637 "exceptions": [], 638 "name": "prepareAsync()", 639 "documentation": "Simulates {@link MediaPlayer#prepareAsync()}. Sets state to PREPARING and posts a callback to\n{@link #invokePreparedListener()} if the current preparation delay for the current media (see\n{@link #getMediaInfo()}) is \u0026gt;\u003d 0, otherwise the test suite is responsible for calling {@link\n#invokePreparedListener()} directly if required.\n\n@see MediaInfo#setPreparationDelay(int)\n@see #invokePreparedListener()\n" 640 }, 641 "resetStaticState()": { 642 "isImplementation": false, 643 "modifiers": [ 644 "public", 645 "static" 646 ], 647 "params": [], 648 "returnType": "void", 649 "exceptions": [], 650 "name": "resetStaticState()" 651 }, 652 "scheduleNextPlaybackEvent()": { 653 "isImplementation": false, 654 "modifiers": [ 655 "private" 656 ], 657 "params": [], 658 "returnType": "void", 659 "exceptions": [], 660 "name": "scheduleNextPlaybackEvent()" 661 }, 662 "seekTo(int)": { 663 "isImplementation": true, 664 "modifiers": [ 665 "protected" 666 ], 667 "params": [ 668 "seekTo" 669 ], 670 "returnType": "void", 671 "exceptions": [], 672 "name": "seekTo(int)", 673 "documentation": "Simulates seeking to specified position. The seek will complete after {@link #seekDelay} ms\n(defaults to 0), or else if seekDelay is negative then the controlling test is expected to\nsimulate seek completion by manually invoking {@link #invokeSeekCompleteListener}.\n\n@param seekTo the offset (in ms) from the start of the track to seek to.\n" 674 }, 675 "seekTo(long,int)": { 676 "isImplementation": true, 677 "modifiers": [ 678 "protected" 679 ], 680 "params": [ 681 "seekTo", 682 "mode" 683 ], 684 "returnType": "void", 685 "exceptions": [], 686 "minSdk": 26, 687 "name": "seekTo(long,int)" 688 }, 689 "setAudioSessionId(int)": { 690 "isImplementation": true, 691 "modifiers": [ 692 "protected" 693 ], 694 "params": [ 695 "sessionId" 696 ], 697 "returnType": "void", 698 "exceptions": [], 699 "name": "setAudioSessionId(int)" 700 }, 701 "setAudioStreamType(int)": { 702 "isImplementation": true, 703 "modifiers": [ 704 "protected" 705 ], 706 "params": [ 707 "audioStreamType" 708 ], 709 "returnType": "void", 710 "exceptions": [], 711 "name": "setAudioStreamType(int)" 712 }, 713 "setCreateListener(org.robolectric.shadows.ShadowMediaPlayer.CreateListener)": { 714 "isImplementation": false, 715 "modifiers": [ 716 "public", 717 "static" 718 ], 719 "params": [ 720 "createListener" 721 ], 722 "returnType": "void", 723 "exceptions": [], 724 "name": "setCreateListener(org.robolectric.shadows.ShadowMediaPlayer.CreateListener)", 725 "documentation": "Sets a listener that is invoked whenever a new shadowed {@link MediaPlayer}\nobject is constructed.\n\nRegistering a listener gives you a chance to\ncustomize the shadowed object appropriately without needing to modify the\napplication-under-test to provide access to the instance at the appropriate\npoint in its life cycle. This is useful because normally a new\n{@link MediaPlayer} is created and {@link #setDataSource setDataSource()}\nis invoked soon after, without a break in the code. Using this callback\nmeans you don\u0027t have to change this common pattern just so that you can\ncustomize the shadow for testing.\n\n@param createListener\n the listener to be invoked\n" 726 }, 727 "setCurrentPosition(int)": { 728 "isImplementation": false, 729 "modifiers": [ 730 "public" 731 ], 732 "params": [ 733 "position" 734 ], 735 "returnType": "void", 736 "exceptions": [], 737 "name": "setCurrentPosition(int)", 738 "documentation": "Sets the current position, bypassing the normal state checking. Use with\ncare.\n\n@param position\n the new playback position.\n" 739 }, 740 "setDataSource(android.content.Context,android.net.Uri,java.util.Map\u003cjava.lang.String,java.lang.String\u003e)": { 741 "isImplementation": true, 742 "modifiers": [ 743 "protected" 744 ], 745 "params": [ 746 "context", 747 "uri", 748 "headers" 749 ], 750 "returnType": "void", 751 "exceptions": [ 752 "java.io.IOException" 753 ], 754 "name": "setDataSource(android.content.Context,android.net.Uri,java.util.Map\u003cjava.lang.String,java.lang.String\u003e)" 755 }, 756 "setDataSource(java.io.FileDescriptor,long,long)": { 757 "isImplementation": true, 758 "modifiers": [ 759 "protected" 760 ], 761 "params": [ 762 "fd", 763 "offset", 764 "length" 765 ], 766 "returnType": "void", 767 "exceptions": [ 768 "java.io.IOException" 769 ], 770 "name": "setDataSource(java.io.FileDescriptor,long,long)" 771 }, 772 "setDataSource(java.lang.String)": { 773 "isImplementation": true, 774 "modifiers": [ 775 "protected" 776 ], 777 "params": [ 778 "path" 779 ], 780 "returnType": "void", 781 "exceptions": [ 782 "java.io.IOException" 783 ], 784 "name": "setDataSource(java.lang.String)" 785 }, 786 "setDataSource(java.lang.String,java.util.Map\u003cjava.lang.String,java.lang.String\u003e)": { 787 "isImplementation": true, 788 "modifiers": [ 789 "protected" 790 ], 791 "params": [ 792 "uri", 793 "headers" 794 ], 795 "returnType": "void", 796 "exceptions": [ 797 "java.io.IOException" 798 ], 799 "name": "setDataSource(java.lang.String,java.util.Map\u003cjava.lang.String,java.lang.String\u003e)" 800 }, 801 "setDataSource(org.robolectric.shadows.util.DataSource)": { 802 "isImplementation": false, 803 "modifiers": [ 804 "public" 805 ], 806 "params": [ 807 "dataSource" 808 ], 809 "returnType": "void", 810 "exceptions": [ 811 "java.io.IOException" 812 ], 813 "name": "setDataSource(org.robolectric.shadows.util.DataSource)", 814 "documentation": "Common code path for all {@code setDataSource()} implementations.\n\n* Checks for any specified exceptions for the specified data source and throws them.\u003c/li\u003e\n* Checks the current state and throws an exception if it is in an invalid state.\u003c/li\u003e\n* If no exception is thrown in either of the previous two steps, then {@link #doSetDataSource(DataSource)} is called to set the data source.\u003c/li\u003e\n* Sets the player state to {@code INITIALIZED}.\u003c/li\u003e\n\nUsually this method would not be called directly, but indirectly through one of the\nother {@link #setDataSource(String)} implementations, which use {@link DataSource#toDataSource(String)}\nmethods to convert their discrete parameters into a single {@link DataSource} instance.\n\n@param dataSource the data source that is being set.\n@throws IOException if the specified data source has been configured to throw an IO exception.\n@see #addException(DataSource, IOException)\n@see #addException(DataSource, RuntimeException)\n@see #doSetDataSource(DataSource)\n" 815 }, 816 "setInvalidStateBehavior(org.robolectric.shadows.ShadowMediaPlayer.InvalidStateBehavior)": { 817 "isImplementation": false, 818 "modifiers": [ 819 "public" 820 ], 821 "params": [ 822 "invalidStateBehavior" 823 ], 824 "returnType": "void", 825 "exceptions": [], 826 "name": "setInvalidStateBehavior(org.robolectric.shadows.ShadowMediaPlayer.InvalidStateBehavior)", 827 "documentation": "Specifies how the media player should behave when a method is invoked in an\ninvalid state. Three modes are supported (as defined by the\n{@link InvalidStateBehavior} enum):\n\n### {@link InvalidStateBehavior#SILENT}\nNo invalid state checking is done at all. All methods can be\ninvoked from any state without throwing any exceptions or invoking the\nerror listener.\n\nThis mode is provided primarily for backwards compatibility, and for this\nreason it is the default. For proper testing one of the other two modes is\nprobably preferable.\n\n### {@link InvalidStateBehavior#EMULATE}\nThe shadow will attempt to emulate the behavior of the actual\n{@link MediaPlayer} implementation. This is based on a reading of the\ndocumentation and on actual experiments done on a Jelly Bean device. The\nofficial documentation is not all that clear, but basically methods fall\ninto three categories:\n* Those that log an error when invoked in an invalid state but don\u0027t\n throw an exception or invoke {@code onError()}. An example is\n {@link #getVideoHeight()}.\n* Synchronous error handling: methods always throw an exception (usually\n {@link IllegalStateException} but don\u0027t invoke {@code onError()}.\n Examples are {@link #prepare()} and {@link #setDataSource(String)}.\n* Asynchronous error handling: methods don\u0027t throw an exception but\n invoke {@code onError()}.\n\nAdditionally, all three methods behave synchronously (throwing\n{@link IllegalStateException} when invoked from the END state.\n\nTo complicate matters slightly, the official documentation sometimes\ncontradicts observed behavior. For example, the documentation says it is\nillegal to call {@link #setDataSource} from the ERROR state - however, in\npractice it works fine. Conversely, the documentation says that it is legal\nto invoke {@link #getCurrentPosition()} from the INITIALIZED state, however\ntesting showed that this caused an error. Wherever there is a discrepancy\nbetween documented and observed behavior, this implementation has gone with\nthe most conservative implementation (ie, it is illegal to invoke\n{@link #setDataSource} from the ERROR state and likewise illegal to invoke\n{@link #getCurrentPosition()} from the INITIALIZED state.\n\n### {@link InvalidStateBehavior#ASSERT}\nThe shadow will raise an assertion any time that a method is\ninvoked in an invalid state. The philosophy behind this mode is that to\ninvoke a method in an invalid state is a programming error - a bug, pure\nand simple. As such it should be discovered and eliminated at development and\ntesting time, rather than anticipated and handled at runtime. Asserting is\na way of testing for these bugs during testing.\n\n@param invalidStateBehavior\n the behavior mode for this shadow to use during testing.\n@see #getInvalidStateBehavior()\n" 828 }, 829 "setLooping(boolean)": { 830 "isImplementation": true, 831 "modifiers": [ 832 "protected" 833 ], 834 "params": [ 835 "looping" 836 ], 837 "returnType": "void", 838 "exceptions": [], 839 "name": "setLooping(boolean)" 840 }, 841 "setOnCompletionListener(android.media.MediaPlayer.OnCompletionListener)": { 842 "isImplementation": true, 843 "modifiers": [ 844 "protected" 845 ], 846 "params": [ 847 "listener" 848 ], 849 "returnType": "void", 850 "exceptions": [], 851 "name": "setOnCompletionListener(android.media.MediaPlayer.OnCompletionListener)" 852 }, 853 "setOnErrorListener(android.media.MediaPlayer.OnErrorListener)": { 854 "isImplementation": true, 855 "modifiers": [ 856 "protected" 857 ], 858 "params": [ 859 "listener" 860 ], 861 "returnType": "void", 862 "exceptions": [], 863 "name": "setOnErrorListener(android.media.MediaPlayer.OnErrorListener)" 864 }, 865 "setOnInfoListener(android.media.MediaPlayer.OnInfoListener)": { 866 "isImplementation": true, 867 "modifiers": [ 868 "protected" 869 ], 870 "params": [ 871 "listener" 872 ], 873 "returnType": "void", 874 "exceptions": [], 875 "name": "setOnInfoListener(android.media.MediaPlayer.OnInfoListener)" 876 }, 877 "setOnPreparedListener(android.media.MediaPlayer.OnPreparedListener)": { 878 "isImplementation": true, 879 "modifiers": [ 880 "protected" 881 ], 882 "params": [ 883 "listener" 884 ], 885 "returnType": "void", 886 "exceptions": [], 887 "name": "setOnPreparedListener(android.media.MediaPlayer.OnPreparedListener)" 888 }, 889 "setOnSeekCompleteListener(android.media.MediaPlayer.OnSeekCompleteListener)": { 890 "isImplementation": true, 891 "modifiers": [ 892 "protected" 893 ], 894 "params": [ 895 "listener" 896 ], 897 "returnType": "void", 898 "exceptions": [], 899 "name": "setOnSeekCompleteListener(android.media.MediaPlayer.OnSeekCompleteListener)" 900 }, 901 "setSeekDelay(int)": { 902 "isImplementation": false, 903 "modifiers": [ 904 "public" 905 ], 906 "params": [ 907 "seekDelay" 908 ], 909 "returnType": "void", 910 "exceptions": [], 911 "name": "setSeekDelay(int)", 912 "documentation": "Sets the length of time (ms) that seekTo() will delay before completing.\nDefault is 0. If set to -1, then seekTo() will not call the\nOnSeekCompleteListener automatically; you will need to call\ninvokeSeekCompleteListener() manually.\n\n@param seekDelay\n length of time to delay (ms)\n" 913 }, 914 "setState(org.robolectric.shadows.ShadowMediaPlayer.State)": { 915 "isImplementation": false, 916 "modifiers": [ 917 "public" 918 ], 919 "params": [ 920 "state" 921 ], 922 "returnType": "void", 923 "exceptions": [], 924 "name": "setState(org.robolectric.shadows.ShadowMediaPlayer.State)", 925 "documentation": "Forces the @link MediaPlayer} into the specified state. Uses the states as\ndefined in the {@link MediaPlayer} documentation.\n\nNote that by invoking this method directly you can get the player into an\ninconsistent state that a real player could not be put in (eg, in the END\nstate but with playback events still happening). Use with care.\n\n@param state\n the new state of the {@link MediaPlayer}, as defined in the\n MediaPlayer documentation.\n@see #getState\n@see MediaPlayer\n" 926 }, 927 "setVolume(float,float)": { 928 "isImplementation": true, 929 "modifiers": [ 930 "protected" 931 ], 932 "params": [ 933 "left", 934 "right" 935 ], 936 "returnType": "void", 937 "exceptions": [], 938 "name": "setVolume(float,float)" 939 }, 940 "start()": { 941 "isImplementation": true, 942 "modifiers": [ 943 "protected" 944 ], 945 "params": [], 946 "returnType": "void", 947 "exceptions": [], 948 "name": "start()", 949 "documentation": "Simulates private native method {@link MediaPlayer#_start()}. Sets state to STARTED and calls\n{@link #doStart()} to start scheduling playback callback events.\n\n\u003cp\u003eIf the current state is PLAYBACK_COMPLETED, the current position is reset to zero before\nstarting playback.\n\n@see #doStart()\n" 950 } 951 }, 952 "imports": [ 953 "android.os.Build.VERSION_CODES.O", 954 "org.robolectric.shadows.ShadowMediaPlayer.State.END", 955 "org.robolectric.shadows.ShadowMediaPlayer.State.ERROR", 956 "org.robolectric.shadows.ShadowMediaPlayer.State.IDLE", 957 "org.robolectric.shadows.ShadowMediaPlayer.State.INITIALIZED", 958 "org.robolectric.shadows.ShadowMediaPlayer.State.PAUSED", 959 "org.robolectric.shadows.ShadowMediaPlayer.State.PLAYBACK_COMPLETED", 960 "org.robolectric.shadows.ShadowMediaPlayer.State.PREPARED", 961 "org.robolectric.shadows.ShadowMediaPlayer.State.PREPARING", 962 "org.robolectric.shadows.ShadowMediaPlayer.State.STARTED", 963 "org.robolectric.shadows.ShadowMediaPlayer.State.STOPPED", 964 "org.robolectric.shadows.util.DataSource.toDataSource", 965 "android.content.Context", 966 "android.media.MediaPlayer", 967 "android.net.Uri", 968 "android.os.Handler", 969 "android.os.Looper", 970 "android.os.Message", 971 "android.os.SystemClock", 972 "java.io.FileDescriptor", 973 "java.io.IOException", 974 "java.util.ArrayList", 975 "java.util.EnumSet", 976 "java.util.HashMap", 977 "java.util.Iterator", 978 "java.util.Map", 979 "java.util.Map.Entry", 980 "java.util.Random", 981 "java.util.TreeMap", 982 "org.robolectric.annotation.Implementation", 983 "org.robolectric.annotation.Implements", 984 "org.robolectric.annotation.RealObject", 985 "org.robolectric.annotation.Resetter", 986 "org.robolectric.shadow.api.Shadow", 987 "org.robolectric.shadows.util.DataSource", 988 "org.robolectric.shadows.ShadowMediaPlayer.State", 989 "org.robolectric.shadows.ShadowMediaPlayer.InvalidStateBehavior", 990 "org.robolectric.shadows.ShadowMediaPlayer.RunList", 991 "org.robolectric.shadows.ShadowMediaPlayer.MediaEvent", 992 "org.robolectric.shadows.ShadowMediaPlayer.MediaInfo", 993 "org.robolectric.shadows.ShadowMediaPlayer.CreateListener", 994 "org.robolectric.shadows.ShadowMediaPlayer.ErrorCallback" 995 ], 996 "name": "org.robolectric.shadows.ShadowMediaPlayer", 997 "documentation": "Automated testing of media playback can be a difficult thing - especially\ntesting that your code properly handles asynchronous errors and events. This\nnear impossible task is made quite straightforward using this implementation\nof {@link MediaPlayer} with Robolectric.\n\nThis shadow implementation provides much of the functionality needed to\nemulate {@link MediaPlayer} initialization and playback behavior without having\nto play actual media files. A summary of the features included are:\n\n* Construction-time callback hook {@link CreateListener} so that\n newly-created {@link MediaPlayer} instances can have their shadows configured\n before they are used.\n* Emulation of the {@link android.media.MediaPlayer.OnCompletionListener\n OnCompletionListener}, {@link android.media.MediaPlayer.OnErrorListener\n OnErrorListener}, {@link android.media.MediaPlayer.OnInfoListener\n OnInfoListener}, {@link android.media.MediaPlayer.OnPreparedListener\n OnPreparedListener} and\n {@link android.media.MediaPlayer.OnSeekCompleteListener\n OnSeekCompleteListener}.\n* Full support of the {@link MediaPlayer} internal states and their\n transition map.\n* Configure time parameters such as playback duration, preparation delay\n and (@link #setSeekDelay seek delay}.\n* Emulation of asynchronous callback events during playback through\n Robolectric\u0027s scheduling system using the {@link MediaInfo} inner class.\n* Emulation of error behavior when methods are called from invalid states,\n or to throw assertions when methods are invoked in invalid states (using\n {@link #setInvalidStateBehavior}).\n* Emulation of different playback behaviors based on the current data\n source, as passed in to {@link #setDataSource(String) setDataSource()}, using\n {@link #addMediaInfo}.\n* Emulation of exceptions when calling {@link #setDataSource} using\n {@link #addException}.\n\n\u003cb\u003eNote\u003c/b\u003e: One gotcha with this shadow is that you need to either configure an\nexception or a {@link ShadowMediaPlayer.MediaInfo} instance for that data source\n(using {@link #addException(DataSource, IOException)} or\n{@link #addMediaInfo(DataSource, MediaInfo)} respectively) \u003ci\u003ebefore\u003c/i\u003e\ncalling {@link #setDataSource}, otherwise you\u0027ll get an\n{@link IllegalArgumentException}.\n\nThe current features of {@code ShadowMediaPlayer} were focused on development\nfor testing playback of audio tracks. Thus support for emulating timed text and\nvideo events is incomplete. None of these features would be particularly onerous\nto add/fix - contributions welcome, of course!\n\n@author Fr Jeremy Krieg, Holy Monastery of St Nectarios, Adelaide, Australia\n" 998}