bilibili / ijkplayer

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
GNU General Public License v2.0
32.5k stars 8.12k forks source link

IAvFormatOption rtmp? #430

Closed msdos2 closed 8 years ago

msdos2 commented 9 years ago

You can activate this function ? import tv.danmaku.ijk.media.player.IAvFormatOption Additionally, the following parameters can be set via command line options (or in code via AVOptions):

rtmp_app

Name of application to connect on the RTMP server. This option overrides the parameter specified in the URI.

rtmp_buffer

Set the client buffer time in milliseconds. The default is 3000.

rtmp_conn

Extra arbitrary AMF connection parameters, parsed from a string, e.g. like B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0. Each value is prefixed by a single character denoting the type, B for Boolean, N for number, S for string, O for object, or Z for null, followed by a colon. For Booleans the data must be either 0 or 1 for FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or 1 to end or begin an object, respectively. Data items in subobjects may be named, by prefixing the type with ’N’ and specifying the name before the value (i.e. NB:myFlag:1). This option may be used multiple times to construct arbitrary AMF sequences.

rtmp_flashver

Version of the Flash plugin used to run the SWF player. The default is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible; <libavformat version>).)

rtmp_flush_interval

Number of packets flushed in the same request (RTMPT only). The default is 10.

rtmp_live

Specify that the media is a live stream. No resuming or seeking in live streams is possible. The default value is any, which means the subscriber first tries to play the live stream specified in the playpath. If a live stream of that name is not found, it plays the recorded stream. The other possible values are live and recorded.

rtmp_pageurl

URL of the web page in which the media was embedded. By default no value will be sent.

rtmp_playpath

Stream identifier to play or to publish. This option overrides the parameter specified in the URI.

rtmp_subscribe

Name of live stream to subscribe to. By default no value will be sent. It is only sent if the option is specified or if rtmp_live is set to live.

rtmp_swfhash

SHA256 hash of the decompressed SWF file (32 bytes).

rtmp_swfsize

Size of the decompressed SWF file, required for SWFVerification.

rtmp_swfurl

URL of the SWF player for the media. By default no value will be sent.

rtmp_swfverify

URL to player swf file, compute hash/size automatically.

rtmp_tcurl

URL of the target stream. Defaults to proto://host[:port]/app.
Android4MediaPlayer commented 9 years ago

plz call the api setOption

msdos2 commented 9 years ago

Could you please explain me how to use setOption to accomplish what's done with IAvFormatOption? I haven't been able to do it myself. An snippet would be great.

Thanks,

bbcallen commented 9 years ago

https://github.com/Bilibili/ijkplayer/blob/0d22fe510561a82de1ac8238a6e11757b24c37ea/android/ijkplayer/sample/src/main/java/tv/danmaku/ijk/media/sample/widget/media/IjkVideoView.java#L314

ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, <key>, <value>);
msdos2 commented 9 years ago

ple I/IJKMEDIA: ===== options ===== 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: player-opts : mediacodec = 1 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: player-opts : mediacodec-auto-rotate = 1 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: player-opts : opensles = 0 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: player-opts : overlay-format = 842225234 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: player-opts : framedrop = 1 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: player-opts : start-on-prepared = 0 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: format-opts : ijkinject-opaque = 1049890 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: format-opts : http-detect-range-support = 0 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: format-opts : rtmp_app = pull 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: format-opts : rtmp_pageurl = http://leton.tv/player.php?streampage=hollywood562&width=600&height=450 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: format-opts : rtmp_playpath = hollywood562?keys=IAeP9yoqiNb-nXwovV4VqA&keyt=1442321306 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: format-opts : rtmp_swfurl = http://files.leton.tv/jwplayer.flash 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: codec-opts : skip_loop_filter = 48 09-15 10:59:43.856 1481-1481/tv.danmaku.ijk.media.sample I/IJKMEDIA: =================== 09-15 10:59:43.856 1481-1780/tv.danmaku.ijk.media.sample I/IJKMEDIA: SDL_RunThread: [1780] ff_msg_loop 09-15 10:59:43.856 1481-1780/tv.danmaku.ijk.media.sample D/IJKMEDIA: message_loop 09-15 10:59:43.856 1481-1780/tv.danmaku.ijk.media.sample D/IJKMEDIA: FFP_MSG_FLUSH: 09-15 10:59:43.866 1481-1481/tv.danmaku.ijk.media.sample D/IJKMEDIA: ijkmp_prepare_async()=0 09-15 10:59:43.866 1481-1782/tv.danmaku.ijk.media.sample I/IJKMEDIA: SDL_RunThread: [1782] ff_read 09-15 10:59:43.866 1481-1781/tv.danmaku.ijk.media.sample I/IJKMEDIA: SDL_RunThread: [1781] ff_vout 09-15 10:59:43.866 1481-1781/tv.danmaku.ijk.media.sample D/IJKMEDIA: ffpipenode_create_video_output_from_android_mediacodec() 09-15 10:59:43.866 1481-1782/tv.danmaku.ijk.media.sample W/IJKMEDIA: remove 'timeout' option for rtmp. 09-15 10:59:43.936 1481-1782/tv.danmaku.ijk.media.sample D/IJKMEDIA: Handshaking... 09-15 10:59:43.996 1481-1560/tv.danmaku.ijk.media.sample D/OpenGLRenderer: endAllStagingAnimators on 0xb4ece400 (ListView) with handle 0xa064b2d0 09-15 10:59:44.006 1481-1481/tv.danmaku.ijk.media.sample I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@15870884 time:55999190 09-15 10:59:44.056 1481-1782/tv.danmaku.ijk.media.sample D/IJKMEDIA: Type answer 3 09-15 10:59:44.056 1481-1782/tv.danmaku.ijk.media.sample D/IJKMEDIA: Server version 13.14.10.13 09-15 10:59:44.056 1481-1782/tv.danmaku.ijk.media.sample D/IJKMEDIA: Proto = rtmp, path = /, app = pull, fname = hollywood562?keys=IAeP9yoqiNb-nXwovV4VqA&keyt=1442321306 09-15 10:59:44.176 1481-1782/tv.danmaku.ijk.media.sample E/IJKMEDIA: rtmp://80.82.70.233/: I/O error ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "http-detect-range-support", 0); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "rtmp_app", "pull"); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "rtmp_pageurl", "http://leton.tv/player.php?streampage=tcm753&width=600&height=450"); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "rtmp_playpath", "tcm753?keys=nvVJp_3fMvR6Z4zIzZaFIQ&keyt=1442322354"); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "rtmp_swfurl","http://files.leton.tv/jwplayer.flash" ); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "rtmp_live","1" ); mVideoView.setVideoPath("rtmp://80.82.70.233/");

bbcallen commented 9 years ago

Can you play this url with other player?

msdos2 commented 9 years ago

Yes, it works with Vitaminio (for example)

bbcallen commented 8 years ago

Feel free to reopen if any more question.