Bug 1350821 - Notify the mediaElement to render subtitle when the mCaption was created or re-created. r=rillian

MozReview-Commit-ID: 3RM7u8jumT9

--HG--
extra : rebase_source : 2a3ed8f304ac8fdf9c0cc897e2f70bd2d23e8101
This commit is contained in:
bechen 2017-03-28 16:48:40 +08:00
Родитель 83749eaa68
Коммит d75825c747
2 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -138,6 +138,7 @@ nsVideoFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
if (!aElements.AppendElement(mCaptionDiv))
return NS_ERROR_OUT_OF_MEMORY;
UpdateTextTrack();
}
// Set up "videocontrols" XUL element which will be XBL-bound to the
@ -776,3 +777,11 @@ bool nsVideoFrame::HasVideoData()
element->GetVideoSize(&size);
return size != nsIntSize(0,0);
}
void nsVideoFrame::UpdateTextTrack()
{
HTMLMediaElement* element = static_cast<HTMLMediaElement*>(GetContent());
if (element) {
element->NotifyCueDisplayStatesChanged();
}
}

Просмотреть файл

@ -128,6 +128,9 @@ protected:
// elements, not for frames for audio elements.
void UpdatePosterSource(bool aNotify);
// Notify the mediaElement that the mCaptionDiv was created.
void UpdateTextTrack();
virtual ~nsVideoFrame();
// Anonymous child which is bound via XBL to the video controls.