Author Topic: [HELP] Snaps Mute  (Read 2857 times)

arthurvalenca

  • Sr. Member
  • ****
  • Posts: 125
    • View Profile
[HELP] Snaps Mute
« on: December 03, 2019, 09:21:35 AM »
Hello everyone I have a code that I will put below, but I have difficulty leaving the videos mute, would anyone have any idea for me to be able to mute?

Code: [Select]
###########
## Snaps ##
###########

::OBJECTS1 <- {
artwork_videotheme = fe.add_artwork("snap", x*0.396, y*0.1675, w*0.2085, h*0.510),
}

OBJECTS1.artwork_videotheme.visible=false;

::videoSound <- Vid.NoAudio;
OBJECTS1.artwork_videotheme.video_flags = Vid.NoAudio;

local settings = {
   delay_timer = 0,
   play_delay = 1600,
   stop_play = 235000,
}

function on_transition_videotheme( ttype, var, ttime ) {
 switch ( ttype ) {
  case Transition.StartLayout:
  case Transition.ToNewSelection:
  case Transition.ToNewList:
  case Transition.EndNavigation:
        OBJECTS1.artwork_videotheme.video_flags = Vid.NoAutoStart;
        settings.delay_timer = fe.layout.time;
        OBJECTS1.artwork_videotheme.visible=false;
       break;
  }
 return false;
}

fe.add_transition_callback( "on_transition_videotheme" );

function on_tick_videotheme(tick_time) {
   if ( !OBJECTS1.artwork_videotheme.video_playing && tick_time - settings.delay_timer >= settings.play_delay ) {
   
        OBJECTS1.artwork_videotheme.video_playing = true;
       
        ::videoSound <- Vid.Default;
        OBJECTS1.artwork_videotheme.video_flags = Vid.Default;       
       
        OBJECTS1.artwork_videotheme.visible=true;
       
        OBJECTS1.artwork_videotheme.alpha = 0
        local alpha_artwork_videotheme_0 = {
        property = "alpha", start = 0 end = 255, time = 2000 easing = Easing.Out,
        }
 
        animation.add( PropertyAnimation( OBJECTS1.artwork_videotheme, alpha_artwork_videotheme_0 ) );
       
    }
   
    else if ( tick_time - settings.delay_timer >= settings.stop_play ) {
       
        OBJECTS1.artwork_videotheme.visible=false;
       
    }   
}

fe.add_ticks_callback(this, "on_tick_videotheme");

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: [HELP] Snaps Mute
« Reply #1 on: December 03, 2019, 04:19:22 PM »
i see that u already have the  ".video_flags = Vid.NoAudio" in use

i think that it might be with using the visible = true  or false

i have found this a problem for me when trying to use in an animation,   with signals.   

sorry cant help.  but watching.

thinking....



help a friend....

arthurvalenca

  • Sr. Member
  • ****
  • Posts: 125
    • View Profile
Re: [HELP] Snaps Mute
« Reply #2 on: December 09, 2019, 10:26:00 AM »
Solution:

Code: [Select]
class UserConfig {

</ label="Mute video snaps sound", help="Yes = sound disabled, No = sound enabled", options="Yes,No", order=9 /> mute_videoSnaps="No";

}
###########
## Snaps ##
###########

::OBJECTS1 <- {
artwork_videotheme = fe.add_artwork("snap", x*0.396, y*0.1675, w*0.2085, h*0.510),
}

OBJECTS1.artwork_videotheme.visible=false;

::videoSound <- Vid.NoAudio;
OBJECTS1.artwork_videotheme.video_flags = Vid.NoAudio;

local settings = {
   delay_timer = 0,
   play_delay = 1600,
   stop_play = 235000,
}

function on_transition_videotheme( ttype, var, ttime ) {
 switch ( ttype ) {
  case Transition.StartLayout:
  case Transition.ToNewSelection:
  case Transition.ToNewList:
  case Transition.EndNavigation:
        OBJECTS1.artwork_videotheme.video_flags = Vid.NoAutoStart;
        settings.delay_timer = fe.layout.time;
        OBJECTS1.artwork_videotheme.visible=false;
       break;
  }
 return false;
}

fe.add_transition_callback( "on_transition_videotheme" );

function on_tick_videotheme(tick_time) {
   if ( !OBJECTS1.artwork_videotheme.video_playing && tick_time - settings.delay_timer >= settings.play_delay ) {
   
        OBJECTS1.artwork_videotheme.video_playing = true;
       
        ::videoSound <- Vid.Default;
       
        if ( my_config["mute_videoSnaps"] == "Yes")
           {
           OBJECTS1.artwork_videotheme.video_flags = Vid.NoAudio;
           }

        if ( my_config["mute_videoSnaps"] == "No")
           {
           OBJECTS1.artwork_videotheme.video_flags = Vid.Default;
           }
       
        OBJECTS1.artwork_videotheme.visible=true;
       
        OBJECTS1.artwork_videotheme.alpha = 0
        local alpha_artwork_videotheme_0 = {
        property = "alpha", start = 0 end = 255, time = 2000 easing = Easing.Out,
        }
 
        animation.add( PropertyAnimation( OBJECTS1.artwork_videotheme, alpha_artwork_videotheme_0 ) );
       
    }
   
    else if ( tick_time - settings.delay_timer >= settings.stop_play ) {
       
        OBJECTS1.artwork_videotheme.visible=false;
       
    }   
}

fe.add_ticks_callback(this, "on_tick_videotheme");

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: [HELP] Snaps Mute
« Reply #3 on: December 09, 2019, 11:06:42 AM »
thanks for the code snip,,  good work...cant wait to see your final theme...
whats your eta do ya think...
help a friend....