Solution to my question
I have a PlaylistsView.mxml
which has a List with all the videos. Once clicked it pushes a new view called YtPlayView.mxml
<!--YtPlayView.mxml-->
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:popup="views.popup.*"
title="{data.title}" viewActivate="init()" viewDeactivate="deactivateYoutubePlayer()">
<fx:Script source="ytfeeds/YoutubePlayer.as"/>
<fx:Script>
<![CDATA[
public function deactivateYoutubePlayer():void{
PopUpManager.removePopUp(ytcPopup);
dispose();
}
]]>
</fx:Script>
</s:View>
In YoutubePlayer.as
, onPlayerReady(event:Event)
I add a mouseclick eventlistener player.addEventListener(MouseEvent.CLICK,showPlayerControl);
<!--YoutubePlayer.as contents-->
public function showPlayerControl(event:MouseEvent):void{
ytcPopup=new PlayerControls();
ytcPopup.player=player;
ytcPopup.duration=data.duration;
ytcPopup.currentPosition="00:00:00";
ytcPopup.open(this,true);
ytcPopup.width = this.stage.width;
ytcPopup.setStyle("modalTransparency",0);
ytcPopup.setStyle("modalTransparencyBlur",3);
ytcPopup.setStyle("modalTransparencyColor", "#ff0000");
if(ytcPopup.player.getPlayerState()==1){
ytcPopup.playPauseBtn.setStyle("icon",ytcPopup.iconPause);
}
else if(ytcPopup.player.getPlayerState()==2){
ytcPopup.playPauseBtn.setStyle("icon",ytcPopup.iconPlay);
}
ytcPopup.y = this.stage.height-195;
PopUpManager.bringToFront(ytcPopup);
if(player.getCurrentTime()!=0)
ytcPopup.ytVideoSlider.value=player.getCurrentTime();
}
Which gives me something like below (It's a portrait view, on Landscape view it comes on top of the video)
If anyone wants more source code or help, i'll be happy to help :) Just drop a comment.