Search Results

Search found 1 results on 1 pages for 'giorrrgio'.

Page 1/1 | 1 

  • OSMF seek with Amazon Cloudfront

    - by giorrrgio
    I've written a little OSMF player that streams via RTMP from Amazon Cloudfront. There's a known issue, the mp3 duration is not correctly readed from metadata and thus the seek function is not working. I know there's a workaround implying the use of getStreamLength function of NetConnection, which I successfully implemented in a previous non-OSMF player, but now I don't know how and when to call it, in terms of OSMF Events and Traits. This code is not working: protected function initApp():void { //the pointer to the media var resource:URLResource = new URLResource( STREAMING_PATH ); // Create a mediafactory instance mediaFactory = new DefaultMediaFactory(); //creates and sets the MediaElement (generic) with a resource and path element = mediaFactory.createMediaElement( resource ); var loadTrait:NetStreamLoadTrait = element.getTrait(MediaTraitType.LOAD) as NetStreamLoadTrait; loadTrait.addEventListener(LoaderEvent.LOAD_STATE_CHANGE, _onLoaded); player = new MediaPlayer( element ); //Marker 5: Add MediaPlayer listeners for media size and current time change player.addEventListener( DisplayObjectEvent.MEDIA_SIZE_CHANGE, _onSizeChange ); player.addEventListener( TimeEvent.CURRENT_TIME_CHANGE, _onProgress ); initControlBar(); } private function onGetStreamLength(result:Object):void { Alert.show("The stream length is " + result + " seconds"); duration = Number(result); } private function _onLoaded(e:LoaderEvent):void { if (e.newState == LoadState.READY) { var loadTrait:NetStreamLoadTrait = player.media.getTrait(MediaTraitType.LOAD) as NetStreamLoadTrait; if (loadTrait && loadTrait.netStream) { var responder:Responder = new Responder(onGetStreamLength); loadTrait.connection.call("getStreamLength", responder, STREAMING_PATH); } } }

    Read the article

1