open [2/2]
Opens a music resource using a URL.
int open(String url, long startPos)
Calling this method triggers the onPlayerStateChanged callback. After receiving the playback state OPEN_COMPLETED, you can call the play method to play the media file.
Note: If the music resource you want to open is protected by digital rights management, you must use this method. For music resources not protected by digital rights management, you can choose to use this method or the
open method.Parameters
- url
- The path of the music resource. Supports both local and online files.
- startPos
- The starting playback position in milliseconds. (Default is 0.)
Return Values
- 0: Success.
- < 0: Failure. See
Error Codesfor details and resolution suggestions.