Merge branch hotfix/v8.1.1 into develop

This commit is contained in:
papacarlo
2024-07-26 08:06:11 +00:00
6 changed files with 73 additions and 25 deletions

View File

@ -152,7 +152,7 @@ void QCefView_Media::OnMediaEnd(bool isFromResize)
void QCefView_Media::OnMediaPlayerCommand(NSEditorApi::CAscExternalMediaPlayerCommand* data)
{
std::string sCmd = data->get_Cmd();
// panel and video widget commands
if (sCmd == "showMediaControl")
{
showMediaControl(data);
@ -165,6 +165,23 @@ void QCefView_Media::OnMediaPlayerCommand(NSEditorApi::CAscExternalMediaPlayerCo
{
updateGeometry(data);
}
// player commands
else if (sCmd == "play" || sCmd == "resume")
{
m_pMediaView->Play();
}
else if (sCmd == "pause")
{
m_pMediaView->Pause();
}
else if (sCmd == "stop")
{
m_pMediaView->Stop();
}
else if (sCmd == "togglePause")
{
m_pMediaView->TogglePause();
}
else
{
#ifdef DEBUG_MEDIA_PLAYER
@ -251,8 +268,9 @@ void QCefView_Media::showMediaControl(NSEditorApi::CAscExternalMediaPlayerComman
int xOffset = 0, yOffset = 0;
m_pMediaView = new QAscVideoView(getMainPanel(this, xOffset, yOffset), true);
QObject::connect(m_pMediaView, SIGNAL(onKeyDown(int, Qt::KeyboardModifiers)),
this, SLOT(onMediaKeyDown(int, Qt::KeyboardModifiers)));
// NOTE: uncomment if you want to handle key events from media player
// QObject::connect(m_pMediaView, SIGNAL(onKeyDown(int,Qt::KeyboardModifiers)),
// this, SLOT(onMediaKeyDown(int,Qt::KeyboardModifiers)));
m_pMediaView->setPlayListUsed(false);
m_pMediaView->setFullScreenUsed(false);
@ -289,7 +307,6 @@ void QCefView_Media::hideMediaControl()
if (!m_pMediaView)
return;
m_pMediaView->disconnect();
m_pMediaView->RemoveFromPresentation();
m_pMediaView = nullptr;
}
@ -308,15 +325,10 @@ void QCefView_Media::updateGeometry(NSEditorApi::CAscExternalMediaPlayerCommand*
void QCefView_Media::onMediaKeyDown(int key, Qt::KeyboardModifiers mods)
{
switch (key)
{
case Qt::Key_Escape:
{
hideMediaControl();
setFocus();
break;
}
default:
break;
}
// NOTE: here can be handled some key events while media is playing
// switch (key)
// {
// default:
// break;
// }
}

View File

@ -51,7 +51,9 @@ public:
virtual QWidget* getMainWindow();
public:
void PlayPause();
void Play();
void Pause();
void TogglePause();
void ChangeVolume(int nValue);
void ChangeSeek(int nValue);
void ToggleMute();

View File

@ -117,7 +117,6 @@ QAscVideoView::QAscVideoView(QWidget *parent, bool bIsPresentationMode) : QWidge
m_pInternal->m_bIsEnabledPlayList = true;
m_pInternal->m_bIsEnabledFullscreen = true;
m_pInternal->m_bIsPresentationModeMediaTypeSended = false;
m_pInternal->m_bIsDestroy = false;
m_pInternal->m_bIsMuted = false;
m_pInternal->m_bIsSeekEnabled = true;
@ -268,13 +267,16 @@ void QAscVideoView::keyPressEvent(QKeyEvent *event)
}
case Qt::Key_O:
{
if (m_pInternal->m_bIsPresentationMode)
break;
if (static_cast<int>(ee) == Qt::ControlModifier)
m_pInternal->m_pPlaylist->slotButtonAdd();
break;
}
case Qt::Key_Space:
{
PlayPause();
TogglePause();
break;
}
case Qt::Key_M:
@ -284,15 +286,30 @@ void QAscVideoView::keyPressEvent(QKeyEvent *event)
}
case Qt::Key_N:
{
if (m_pInternal->m_bIsPresentationMode)
break;
Footer()->m_pInternal->m_pSlider->setValue(100000);
m_pInternal->m_pPlaylist->Next();
break;
}
case Qt::Key_P:
{
if (m_pInternal->m_bIsPresentationMode)
break;
Footer()->m_pInternal->m_pSlider->setValue(0);
m_pInternal->m_pPlaylist->Prev();
}
case Qt::Key_Escape:
{
if (m_pInternal->m_bIsPresentationMode)
{
Stop();
parentWidget()->setFocus();
}
break;
}
default:
break;
}
@ -323,7 +340,17 @@ bool QAscVideoView::eventFilter(QObject *watched, QEvent *event)
return QWidget::eventFilter(watched, event);
}
void QAscVideoView::PlayPause()
void QAscVideoView::Play()
{
m_pInternal->m_pPlayer->setPlay();
}
void QAscVideoView::Pause()
{
m_pInternal->m_pPlayer->setPause();
}
void QAscVideoView::TogglePause()
{
if (m_pInternal->m_bIsPlay)
m_pInternal->m_pPlayer->setPlay();
@ -463,8 +490,9 @@ void QAscVideoView::setMedia(QString sMedia, bool isStart)
void QAscVideoView::Stop()
{
m_pInternal->m_bIsDestroy = true;
m_pInternal->m_pPlayer->stop();
this->hide();
m_pInternal->m_bIsPresentationModeMediaTypeSended = false;
}
void QAscVideoView::RemoveFromPresentation()
@ -563,7 +591,7 @@ void QAscVideoView::slotVideoAvailableChanged(bool isVideoAvailable)
if (m_pInternal->m_bIsPresentationMode && !m_pInternal->m_bIsPresentationModeMediaTypeSended)
{
m_pInternal->m_bIsPresentationModeMediaTypeSended = true;
if (!m_pInternal->m_pPlayer->isAudio() && !m_pInternal->m_bIsDestroy)
if (!m_pInternal->m_pPlayer->isAudio())
{
this->show();
Footer()->show();

View File

@ -91,6 +91,7 @@ QAscVideoWidget::QAscVideoWidget(QWidget *parent)
QObject::connect(m_pEngine, SIGNAL(positionChanged(qint64)), this, SLOT(slotPositionChange(qint64)));
QObject::connect(m_pEngine, SIGNAL(videoAvailableChanged(bool)), this, SLOT(slotVideoAvailableChanged(bool)));
QObject::connect(m_pEngine, SIGNAL(durationChanged(qint64)), this, SLOT(slotMediaDurationParsed(qint64)));
QObject::connect(m_pEngine, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(slotMediaStatusChanged(QMediaPlayer::MediaStatus)));
#else
m_pVlcPlayer = new CVlcPlayer(this);
m_pVlcPlayer->integrateIntoWidget(this);
@ -459,7 +460,7 @@ void QAscVideoWidget::slotVlcStateChanged(int state)
}
}
}
else if (state == libvlc_Ended)
else if (state == libvlc_Ended || state == libvlc_Stopped)
{
stateQ = QMediaPlayer::StoppedState;
m_sCurrentSource = "";
@ -533,6 +534,12 @@ void QAscVideoWidget::slotMediaDurationParsed(qint64 duration)
}
}
void QAscVideoWidget::slotMediaStatusChanged(QMediaPlayer::MediaStatus mediaStatus)
{
if (mediaStatus == QMediaPlayer::LoadedMedia)
emit videoOutputChanged(m_pEngine->isVideoAvailable());
}
QMediaPlayer* QAscVideoWidget::getEngine()
{
return m_pEngine;

View File

@ -49,8 +49,6 @@ public:
bool m_bIsPresentationMode;
bool m_bIsPresentationModeMediaTypeSended;
bool m_bIsDestroy;
bool m_bIsMuted;
int m_nMutedVolume;
@ -118,6 +116,7 @@ public slots:
void slotPositionChange(qint64 pos);
void slotVideoAvailableChanged(bool isAvailable);
void slotMediaDurationParsed(qint64 duration);
void slotMediaStatusChanged(QMediaPlayer::MediaStatus mediaStatus);
#endif
public:

View File

@ -258,7 +258,7 @@ void QFooterPanel::setTimeOnLabel(qint64 time)
void QFooterPanel::onPlayPauseBtnClicked()
{
m_pInternal->m_pView->PlayPause();
m_pInternal->m_pView->TogglePause();
}
void QFooterPanel::onVolumeBtnClicked()