[Tex/LaTex] Beamer TOC on each subsection

beamertable of contents

I am currently making a presentation using Beamer.
I have section, subsection, subsubsections in my presentation. I want to achieve the following:

  1. The TOC at the starting of the presentation won't show subsubsections.
  2. Starting of a subsection, I need a TOC of that subsection as well as subsubsections.

I know the first can be achieved using \setcounter{tocdepth}{2}.
But I can't get the second one. It would be better if the subsubsections of the current subsection is highlighted and others are faded.
Please help me out.

note: I have checked this: Beamer Mini-TOC. However, the difference is I want a TOC at the starting of subsections.

I also have checked this: Beamer Presentation: Show TOC at beginning of Unnumbered Subsection (Subsection*)
However, the difference is this shows the whole TOC (although shaded) at the starting of each subsection. I wanted a mini-TOC, particularly for the current subsection. If a subsection doesn't have a subsubsection, no TOC should be generated.

Best Answer

This did the job for me. Although not completely. But for all practical purposes, it is close enough.

\AtBeginSubsection[]{
  \frame<beamer>{ 
    \frametitle{Outline}   

\tableofcontents[currentsection,currentsubsection,sectionstyle=show/hide,subsectionstyle=show/shaded/hide,subsubsectionstyle=show/show/shaded/shaded]}
}