Skip to content

Commit

Permalink
Merge pull request #42 from AKalinich-Luxoft/fix/fix_start_streaming_…
Browse files Browse the repository at this point in the history
…popup_prompt

Fix start audio/video streaming popup prompt
  • Loading branch information
jacobkeeler authored Nov 22, 2017
2 parents e206fc7 + 1c6d116 commit a7a60c7
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions ffw/NavigationRPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ FFW.Navigation = FFW.RPCObserver.create(
* Error codes will be injected into response.
*/
errorResponsePull: {},
/**
* Contains pointer to currently active popup window with start Audio
* streaming in the model or null if does not exists
*/
startAudioStreamingPopup: null,
/**
* Contains pointer to currently active popup window with start Video
* streaming in the model or null if does not exists
*/
startVideoStreamingPopup: null,
/**
* access to basic RPC functionality
*/
Expand Down Expand Up @@ -280,7 +290,11 @@ FFW.Navigation = FFW.RPCObserver.create(
case 'Navigation.StartAudioStream':
{
var text = 'Would you like to start Audio stream?';
SDL.PopUp.create().appendTo('body').popupActivate(
if (this.startAudioStreamingPopup && this.startAudioStreamingPopup.active) {
this.startAudioStreamingPopup.deactivate();
}

this.startAudioStreamingPopup = SDL.PopUp.create().appendTo('body').popupActivate(
text, function(result) {
if (result) {
FFW.Navigation.sendNavigationResult(
Expand Down Expand Up @@ -308,6 +322,10 @@ FFW.Navigation = FFW.RPCObserver.create(
SDL.SDLController.getApplicationModel(
request.params.appID
).navigationAudioStream = null;
if (this.startAudioStreamingPopup && this.startAudioStreamingPopup.active) {
this.startAudioStreamingPopup.deactivate();
this.set('startAudioStreamingPopup', null);
}
this.sendNavigationResult(
SDL.SDLModel.data.resultCode.SUCCESS,
request.id,
Expand Down Expand Up @@ -355,7 +373,11 @@ FFW.Navigation = FFW.RPCObserver.create(
case 'Navigation.StartStream':
{
var text = 'Would you like to start Video stream?';
SDL.PopUp.create().appendTo('body').popupActivate(
if (this.startVideoStreamingPopup && this.startVideoStreamingPopup.active) {
this.startVideoStreamingPopup.deactivate();
}

this.startVideoStreamingPopup = SDL.PopUp.create().appendTo('body').popupActivate(
text, function(result) {
if (result) {
SDL.SDLController.getApplicationModel(request.params.appID)
Expand All @@ -378,13 +400,18 @@ FFW.Navigation = FFW.RPCObserver.create(
SDL.SDLController.getApplicationModel(
request.params.appID
).navigationStream = request.params.url;

break;
}
case 'Navigation.StopStream':
{
SDL.SDLController.getApplicationModel(
request.params.appID
).navigationStream = null;
if (this.startVideoStreamingPopup && this.startVideoStreamingPopup.active) {
this.startVideoStreamingPopup.deactivate();
this.set('startVideoStreamingPopup', null);
}
this.sendNavigationResult(
SDL.SDLModel.data.resultCode.SUCCESS,
request.id,
Expand Down

0 comments on commit a7a60c7

Please # to comment.