mediaplayer

    技术2022-11-22  37

    onerror的return true和false,确实onerror是个很优待考究的地方,

    另外要说的   

        /**

         * Sets the data source (file-path or http/rtsp URL) to use.

         *

         * @param path the path of the file, or the http/rtsp URL of the stream you want to play

         * @throws IllegalStateException if it is called in an invalid state

         */

    public native void setDataSource(String path) throws IOException, IllegalArgumentException, IllegalStateException;

     

        /**

         * Sets the data source (FileDescriptor) to use. It is the caller's responsibility

         * to close the file descriptor. It is safe to do so as soon as this call returns.

         *

         * @param fd the FileDescriptor for the file you want to play

         * @throws IllegalStateException if it is called in an invalid state

         */

        public void setDataSource(FileDescriptor fd)

                throws IOException, IllegalArgumentException, IllegalStateException {

            // intentionally less than LONG_MAX

            setDataSource(fd, 0, 0x7ffffffffffffffL);

        }

     

    从效果上来看如果把手机内存的通过流的方式设置datasource就会跑到onerror(4,-4)

    最新回复(0)