Code Monkey home page Code Monkey logo

Comments (10)

mahmutbayri avatar mahmutbayri commented on August 26, 2024

Hi @mangui,
I'm interested this feature. How is going development? :) I have experience with OSMF but not Flashls API. Could you give me an entry point to implement it?

Thanks.

from flashls.

mangui avatar mangui commented on August 26, 2024

Hi @kalimba
basically you need to retrieve clipStartTime and clipEndTime from StreamingURLResource (available here : https://github.com/mangui/flashls/blob/master/src/org/mangui/osmf/plugins/loader/HLSLoaderBase.as#L117)

then you would have to pass these values to HLS OSMF traits (all traits dealing with playlist duration / media position / buffer size, they are here : https://github.com/mangui/flashls/tree/master/src/org/mangui/osmf/plugins/traits) and take these clipping parameters into account.

having basic clipping working for VoD playlist should not be too complex, but handling live playlist (with sliding window) might be more difficult.

from flashls.

mahmutbayri avatar mahmutbayri commented on August 26, 2024

Hi @mangui,

i'm going to use only for VOD. It is impelented to osmf-hls-plugin. At https://github.com/denivip/osmf-hls-plugin/blob/cc2a21335835a25f929ec091fd0681294f0d92be/HLSPlugin/src/org/denivip/osmf/elements/m3u8Classes/M3U8PlaylistParser.as

from flashls.

mahmutbayri avatar mahmutbayri commented on August 26, 2024

Hi @mangui ,
I have looked around. It is too complex for me. Do you have any schedule to add the feature?

Thanks.

from flashls.

mangui avatar mangui commented on August 26, 2024

no schedule

from flashls.

sathasivam11 avatar sathasivam11 commented on August 26, 2024

Hi @mangui ,
You have mentioned that clipStartTime and clipEndTime values need to be passed to HLS OSMF traits. Could you please elaborate when and how these values need to be handled in traits?

Thanks.

from flashls.

mangui avatar mangui commented on August 26, 2024

Hi @sathasivam11
you need to handle conversion from flashls position/duration/buffer length (which are real position) to
subclip position/duration/buf length.

according to https://github.com/theturtle32/OSMF-AppleHLS/blob/master/OSMF/org/osmf/net/StreamingURLResource.as#L86-L87,

one way is to perform this conversion in the Traits (HLSNetStreamLoadTrait,HLSSeekTrait.as,HLSTimeTrait)
but there is still one issue : when reaching the end of the subclip, the playback should stop automatically. and a playback complete event should be triggered to OSMF.

the best solution would be to add this subclip functionality in flashls itself, and modify _hls.load() prototype (add 2 optional args, clipStartTime and clipEndTime).

from flashls.

mangui avatar mangui commented on August 26, 2024

please note that subclipping has been implemented in FlashlsFlowplayer, refer to the last commits on https://github.com/mangui/flashls/commits/master/src/org/mangui/flowplayer/HLSStreamProvider.as
same logic could be easily adapted to FlashlsOSMF

from flashls.

mahmutbayri avatar mahmutbayri commented on August 26, 2024

Hi @mangui,
If this enhancement is easy for you, adding this would be great, please. I'm experience with OSMF, not Flowplayer or Flashls core.

Thanks

from flashls.

mahmutbayri avatar mahmutbayri commented on August 26, 2024

Hi @mangui

Should i focus there lines to implement it?

flashls/src/org/mangui/osmf/plugins/loader/HLSLoaderBase.as
->

private function _manifestHandler(event : HLSEvent) : void {
var resource : MediaResourceBase = URLResource(_loadTrait.resource);
// retrieve stream type
var streamType : String = (resource as StreamingURLResource).streamType;
if (streamType == null || streamType == StreamType.LIVE_OR_RECORDED) {
if (_hls.type == HLSTypes.LIVE) {
streamType = StreamType.LIVE;
} else {
streamType = StreamType.RECORDED;
}
}
var levels : Vector.<Level> = _hls.levels;
var nbLevel : int = levels.length;
var urlRes : URLResource = resource as URLResource;
var dynamicRes : DynamicStreamingResource = new DynamicStreamingResource(urlRes.url);
var streamItems : Vector.<DynamicStreamingItem> = new Vector.<DynamicStreamingItem>();
for (var i : int = 0; i < nbLevel; i++) {
if (levels[i].width) {
streamItems.push(new DynamicStreamingItem(level2label(levels[i]), levels[i].bitrate / 1024, levels[i].width, levels[i].height));
} else {
streamItems.push(new DynamicStreamingItem(level2label(levels[i]), levels[i].bitrate / 1024));
}
}
dynamicRes.streamItems = streamItems;
dynamicRes.initialIndex = _hls.startlevel;
resource = dynamicRes;
// set Stream Type
var streamUrlRes : StreamingURLResource = resource as StreamingURLResource;
streamUrlRes.streamType = streamType;
try {
var loadedElem : MediaElement = new HLSMediaElement(resource, _hls, event.levels[_hls.startlevel].duration);
LoadFromDocumentLoadTrait(_loadTrait).mediaElement = loadedElem;
updateLoadTrait(_loadTrait, LoadState.READY);
} catch(e : Error) {
updateLoadTrait(_loadTrait, LoadState.LOAD_ERROR);
_loadTrait.dispatchEvent(new MediaErrorEvent(MediaErrorEvent.MEDIA_ERROR, false, false, new MediaError(e.errorID, e.message)));
}
};

flashls/src/org/mangui/osmf/plugins/traits/HLSNetStreamLoadTrait.as
->

private function _mediaTimeHandler(event : HLSEvent) : void {
var time_total : Number = Math.round(10 * event.mediatime.duration) / 10;
var time_loaded : Number = Math.round(10 * (event.mediatime.position + event.mediatime.buffer)) / 10;
if (_time_total != time_total) {
if (time_total < _time_loaded || time_total < 0) {
time_total = NaN;
}
_time_total = time_total;
setBytesTotal(time_total);
}
if (_time_loaded != time_loaded && time_loaded <= time_total) {
_time_loaded = time_loaded;
setBytesLoaded(time_loaded);
}
};

Thanks

from flashls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.