Index: libs/libmythtv/NuppelVideoPlayer.cpp
===================================================================
--- libs/libmythtv/NuppelVideoPlayer.cpp	(revision 11805)
+++ libs/libmythtv/NuppelVideoPlayer.cpp	(working copy)
@@ -4589,6 +4589,13 @@
         videoOutput->ExposeEvent();
 }
 
+bool NuppelVideoPlayer::IsEmbedding(void)
+{
+    if (videoOutput)
+        return videoOutput->IsEmbedding();
+    return false;
+}
+
 void NuppelVideoPlayer::UpdateSeekAmount(bool up)
 {
     if (seekamountpos > 0 && !up)
Index: libs/libmythtv/tv_play.h
===================================================================
--- libs/libmythtv/tv_play.h	(revision 11805)
+++ libs/libmythtv/tv_play.h	(working copy)
@@ -110,6 +110,7 @@
     // Embedding commands for the guidegrid to use in LiveTV
     void EmbedOutput(WId wid, int x, int y, int w, int h);
     void StopEmbeddingOutput(void);
+    bool IsEmbedding(void);
     void EPGChannelUpdate(uint chanid, QString channum);
    
     // Recording commands
Index: libs/libmythtv/NuppelVideoPlayer.h
===================================================================
--- libs/libmythtv/NuppelVideoPlayer.h	(revision 11805)
+++ libs/libmythtv/NuppelVideoPlayer.h	(working copy)
@@ -117,6 +117,7 @@
     void EmbedInWidget(WId wid, int x, int y, int w, int h);
     void StopEmbedding(void);
     void ExposeEvent(void);
+    bool IsEmbedding(void);
 
     // Audio Sets
     void SetNoAudio(void)                     { no_audio_out = true; }
Index: libs/libmythtv/tv_play.cpp
===================================================================
--- libs/libmythtv/tv_play.cpp	(revision 11805)
+++ libs/libmythtv/tv_play.cpp	(working copy)
@@ -1785,7 +1785,10 @@
                 (gContext->GetNumSetting("EndofRecordingExitPrompt") == 1) &&
                 !jumped_back && !editmode)
             {
-                PromptDeleteRecording(tr("End Of Recording"));
+                if (IsEmbedding())
+                    StopEmbeddingOutput();
+                else
+                    PromptDeleteRecording(tr("End Of Recording"));
             }
             
                 
@@ -4938,6 +4941,13 @@
     embedWinID = 0;
 }
 
+bool TV::IsEmbedding(void)
+{
+    if (nvp)
+        return nvp->IsEmbedding();
+    return false;
+}
+
 void TV::doEditSchedule(int editType)
 {
     if (!playbackinfo)
@@ -4965,6 +4975,8 @@
 
     bool changeChannel = false;
     ProgramInfo *nextProgram = NULL;
+    if (!nvp)
+        return;
 
     if (StateIsLiveTV(GetState()))
     {
@@ -5003,12 +5015,13 @@
                     exitPlayer = true;
                     delete nextProgram;
                 }
-                if (paused & !stayPaused)
+                if (paused && !stayPaused)
                     DoPause(false);
                 break;
             }
         }
-        StopEmbeddingOutput();
+        if (IsEmbedding())
+            StopEmbeddingOutput();
     }
     else
     {
@@ -5020,11 +5033,11 @@
         {
             default:
             case kScheduleProgramGuide:
-                    RunProgramGuide(chanid, channum, true);
-                    break;
+                RunProgramGuide(chanid, channum, true);
+                break;
             case kScheduleProgramFinder:
-                    RunProgramFind(true, false);
-                    break;
+                RunProgramFind(true, false);
+                break;
             case kScheduledRecording:
             {
                 QMutexLocker locker(&pbinfoLock);
@@ -5036,15 +5049,33 @@
             }
             case kPlaybackBox:
             {
-                    nextProgram = RunPlaybackBoxPtr((void *)this);
-                    if (nextProgram)
+                long long margin = 
+                    (long long)(nvp->GetFrameRate() * nvp->GetAudioStretchFactor());
+                // keep video paused if only 5 seconds left in recording
+                margin = margin * 5; 
+                QDomElement pbbxmldata;
+                XMLParse *theme = new XMLParse();
+                if (theme->LoadTheme(pbbxmldata, "playback-video"))
+                {
+                    if (!stayPaused && paused && !nvp->IsNearEnd(margin))
                     {
-                        setLastProgram(nextProgram);
-                        jumpToProgram = true;
-                        exitPlayer = true;
-                        delete nextProgram;
+                        DoPause(false);
+                        stayPaused = true;
                     }
-                    break;
+                }
+                if (theme)
+                    delete theme;
+                nextProgram = RunPlaybackBoxPtr((void *)this);
+                if (IsEmbedding())
+                    StopEmbeddingOutput();
+                if (nextProgram)
+                {
+                    setLastProgram(nextProgram);
+                    jumpToProgram = true;
+                    exitPlayer = true;
+                    delete nextProgram;
+                }
+                break;
             }
         }
 
@@ -5064,8 +5095,8 @@
     if (changeChannel)
         EPGChannelUpdate(chanid, channum);
 
-    if (jumpToProgram)
-        activenvp->DiscardVideoFrames(true);
+    if (nvp && jumpToProgram)
+        nvp->DiscardVideoFrames(true);
 
     menurunning = false;
 }
Index: libs/libmythtv/videooutbase.h
===================================================================
--- libs/libmythtv/videooutbase.h	(revision 11805)
+++ libs/libmythtv/videooutbase.h	(working copy)
@@ -257,7 +257,10 @@
     /// \brief Returns true iff we have at least the minimum number of
     ///        decoded frames ready for display.
     bool EnoughPrebufferedFrames(void) { return vbuffers.EnoughPrebufferedFrames(); }
-    
+
+    /// \brief Returns if videooutput is embedding
+    bool IsEmbedding(void) { return embedding; }
+
     /**
      * \brief Blocks until it is possible to return a frame for decoding onto.
      * \param with_lock if true frames are properly locked, but this means you
Index: programs/mythfrontend/playbackbox.cpp
===================================================================
--- programs/mythfrontend/playbackbox.cpp	(revision 11805)
+++ programs/mythfrontend/playbackbox.cpp	(working copy)
@@ -330,8 +330,7 @@
     // theme stuff
     theme->SetWMult(wmult);
     theme->SetHMult(hmult);
-    if (m_player && m_player->GetState() == kState_WatchingLiveTV &&
-        theme->LoadTheme(xmldata,"playback-video"))
+    if (m_player && theme->LoadTheme(xmldata,"playback-video"))
     {
         playbackVideoContainer = true;
         previewPixmapEnabled = false;
@@ -2990,9 +2989,15 @@
                             SLOT(togglePlayListItem()));
     }
 
+    TVState m_tvstate = kState_None;
+    if (m_player)
+        m_tvstate = m_player->GetState();
+    
     if (program->recstatus == rsRecording &&
-        (!(m_player && m_player->GetState() == kState_WatchingLiveTV &&
-           m_player->IsSameProgram(curitem))))
+        (!(m_player && 
+            (m_tvstate == kState_WatchingLiveTV || 
+             m_tvstate == kState_WatchingRecording) &&
+            m_player->IsSameProgram(curitem))))
     {
         popup->addButton(tr("Stop Recording"), this, SLOT(askStop()));
     }
@@ -3682,6 +3687,12 @@
 
 void PlaybackBox::timeout(void)
 {
+    if (m_player && !m_player->IsEmbedding() &&
+        playbackVideoContainer)
+    {
+        exitWin();
+    }
+
     if (titleList.count() <= 1)
         return;
 
