text_plain_output_1.png
from IPython.display import IFrame

from IPython.display import IFrame

from IPython.display import YouTubeVideo

from IPython.display import display, Image # to visualize images

from ipywidgets import widgets

import ipywidgets as widgets       # interactive display

from ipywidgets import widgets
out2 = widgets.Output()
with out2:
    from IPython.display import IFrame
    class BiliVideo(IFrame):
        def __init__(self, id, page=1, width=400, height=300, **kwargs):
            self.id = id
            src = 'https://player.bilibili.com/player.html?bvid={0}&page={1}'.format(id, page)
            super(BiliVideo, self).__init__(src, width, height, **kwargs)
    video = BiliVideo(id=f'BV1D64y1s78e', width=854, height=480, fs=1)
    print('Video available at https://www.bilibili.com/video/{0}'.format(video.id))
    display(video)
out1 = widgets.Output()
with out1:
    from IPython.display import YouTubeVideo
    video = YouTubeVideo(id=f'Q3b_EqFUI00', width=854, height=480, fs=1, rel=0)
    print('Video available at https://youtube.com/watch?v=' + video.id)
    display(video)
out = widgets.Tab([out1, out2])
out.set_title(0, 'Youtube')
out.set_title(1, 'Bilibili')
atform.add_event('Video 0: Introduction')
display(out)