mangui / flashls

HLS Flash Plugin/Player (Chromeless,OSMF,FlowPlayer,mediaelement.js,video.js,Clappr)
http://www.flashls.org
Mozilla Public License 2.0
751 stars 264 forks source link

AutoLoad The First Segement ? #467

Open codex-corp opened 8 years ago

codex-corp commented 8 years ago

Hi @mangui ,

VideoJS parsing the first level in playlist then stop when reached to loadedmetadata ,

can you please explain how to auto load the first segment in current level without autoplay mode or how to trigger hls.startLoad() https://github.com/mangui/flashls/blob/133d83ab5e0f012bdd44c2d772e166b29b93ee1f/src/org/mangui/hls/HLS.as#L295

codex-corp commented 8 years ago

onAddedToStage StageVideo is avalable. INFO:https://github.com/mangui/flashls/releases/tag/v0.4.1.1 DEBUG:StreamBuffer flushed DEBUG:FPSController:stage defined, listen to throttle event INFO:HLSSettings.capLevelToStage = false DEBUG:HLSProvider.init. DEBUG:HLSSettings.logDebug=true DEBUG:HLSSettings.logDebug2=true DEBUG:HLSSettings.minBufferLength=-1 DEBUG:HLSSettings.lowBufferLength=3 DEBUG:HLSSettings.maxBufferLength=120 DEBUG:HLSSettings.startFromLevel=-1 DEBUG:HLSSettings.seekFromLevel=-1 DEBUG:HLSSettings.flushLiveURLCache=false DEBUG:HLSSettings.seekMode=KEYFRAME DEBUG:HLSSettings.manifestLoadMaxRetry=3 DEBUG:HLSSettings.fragmentLoadMaxRetry=3 DEBUG:HLSSettings.capLevelToStage=false DEBUG:HLSSettings.maxLevelCappingMode=downscale INFO:HLSNetStream:close DEBUG:StreamBuffer flushed DEBUG:cancel any manifest load in progress INFO:HLSNetStream:close DEBUG:StreamBuffer flushed DEBUG:cancel any manifest load in progress DEBUG:adaptive playlist:

EXTM3U

EXT-X-VERSION:3

EXT-X-STREAM-INF:BANDWIDTH=921,RESOLUTION=1080x608

chunklist_b921.m3u8

EXT-X-STREAM-INF:BANDWIDTH=250000,RESOLUTION=300x240

chunklist_b250000.m3u8

DEBUG:switch to level 0 DEBUG:(re)load Playlist INFO:HLSProvider: new level index 0 bitrate=921, width=1080, height=608 DEBUG:autoStartLoad!!!!: DEBUG:switch to level 1 DEBUG:(re)load Playlist INFO:HLSProvider: new level index 1 bitrate=250000, width=300, height=240 DEBUG:level 1 playlist:

EXTM3U

EXT-X-VERSION:3

EXT-X-TARGETDURATION:12

EXT-X-MEDIA-SEQUENCE:0

EXTINF:9.8,

media_b250000_0.ts

EXTINF:9.84,

media_b250000_1.ts

EXTINF:9.72,

media_b250000_2.ts

EXTINF:11.12,

media_b250000_3.ts

EXTINF:10.96,

media_b250000_4.ts

EXTINF:11.2,

media_b250000_5.ts

EXTINF:10.28,

media_b250000_6.ts

EXTINF:10.72,

media_b250000_7.ts

EXTINF:10.8,

media_b250000_8.ts

EXTINF:9.68,

media_b250000_9.ts

EXTINF:11.04,

media_b250000_10.ts

EXTINF:9.72,

media_b250000_11.ts

EXTINF:10.0,

media_b250000_12.ts

EXTINF:9.64,

media_b250000_13.ts

EXTINF:9.52,

media_b250000_14.ts

EXTINF:11.36,

media_b250000_15.ts

EXTINF:9.92,

media_b250000_16.ts

EXTINF:9.6,

media_b250000_17.ts

EXTINF:10.44,

media_b250000_18.ts

EXTINF:10.08,

media_b250000_19.ts

EXTINF:10.36,

media_b250000_20.ts

EXTINF:5.614,

media_b250000_21.ts

EXT-X-ENDLIST

DEBUG:updateFragments: unknown PTS info for this level DEBUG:Stream type did change to VOD DEBUG:First level filled with necessary amount of fragments, notify event DEBUG:_switchup[0]=270.4440825190011 DEBUG:_switchdown[1]=1.992632 DEBUG:HLSProvider.paused:true DEBUG:HLSProvider.metadata

mangui commented 8 years ago

@codex-corp this should be handled in flashls video js specific wrapper
https://github.com/mangui/video-js-swf/blob/master/src/com/videojs/providers/HLSProvider.as you should call hls.startLoad() from https://github.com/mangui/video-js-swf/blob/master/src/com/videojs/providers/HLSProvider.as#L89-L104, and surround it by

if (_model.preload == "auto") {
_hls.startLoad();
}
codex-corp commented 8 years ago

Hi @mangui , should be like this ? i have tried it but not work

private function _manifestHandler(event:HLSEvent):void {
          _isManifestLoaded = true;
          _networkState = NetworkState.NETWORK_IDLE;
          _readyState = ReadyState.HAVE_METADATA;
          _duration = event.levels[0].duration;
          _metadata.width = event.levels[0].width;
          _metadata.height = event.levels[0].height;
          if(_isAutoPlay || _looping) {
            _looping = false;
            play();
          }
          if (_model.preload == "auto") {
            _hls.startLoad();
          }
          _model.broadcastEventExternally(ExternalEventName.ON_LOAD_START);
          _model.broadcastEventExternally(ExternalEventName.ON_DURATION_CHANGE, _duration);
          _model.broadcastEvent(new VideoPlaybackEvent(VideoPlaybackEvent.ON_META_DATA, {metadata:_metadata}));
          _model.broadcastEventExternally(ExternalEventName.ON_METADATA, _metadata);
};
mangui commented 8 years ago

I would say so ... I guess you are confident with the fact that preload 'auto' is set ?

codex-corp commented 8 years ago

sure! , http://admin.mangomolo.com/player/video.php