当前位置:网站首页>Website B video is embedded in the web page, and relevant controls are hidden
Website B video is embedded in the web page, and relevant controls are hidden
2022-07-24 06:27:00 【XIE392】
Web page embedding B Station video is mainly used ifame , His address is :
https://player.bilibili.com/player.html?cid=&aid=84267566&page=1&as_wide=1&high_quality=1&danmaku=0
The following parameter description :
| key | attribute |
|---|---|
| cid | It should be a client iid, Can not fill |
| aid | video id, Required |
| page | B Stop video , In the anthology , Several videos ( The default value is 1) |
| as_wide | Whether the widescreen 1: Wide screen , 0: Small screen |
| high_quality | Whether HD |
| danmaku | Whether to open the barrage 1: Turn on ( Default ), 0: close |
among aid Is required , Other parameters can be left blank
This aid How to get it ? This requires a request B Stand at this interface
https://api.bilibili.com/x/web-interface/view?bvid=BV1gY4y1E7h8
1、aid obtain
bvid How to get ? stay B Station play video url We can see

If the web page is uploaded For link extraction, you need to visit the address above to get the video aid

We can call the backend to access , The front end provides bvid, Back end to request B Station to get aid The address of , Return to the front end according to the obtained content
2、 encapsulation
Here we use vue For example :
<template>
<div class="iframe-box">
<div class="vedio">
<iframe class="vedio-iframe" :src="src" frameborder="no" scrolling="no" danmaku="0" allowfullscreen="true" id="iframe" sandbox="allow-top-navigation allow-same-origin allow-forms allow-scripts" ></iframe>
</div>
</div>
</template>
ifame Parameter description :
| key | attribute |
|---|---|
| allowfullscreen | Set up true It is too , Can be called by requestFullscreen() Method to activate full screen mode |
| scrolling | This property controls whether to scroll through the frame auto: Scroll bar displayed when the content of the frame is out of range .yes: Display scroll bars in real time .no: Never show scrollbars . |
| frameborder | This property 1 Value is displayed , The default of this framework 0 Use screen |
| … | … |
There is no more detail here , You can refer to this iframe
js Part of the code :
<script setup lang="ts" name="iframe">
import ( ref ) from "vue";
const props = defineProps({
cid: {
type: String,
default: "",
},
aid: {
type: String,
default: "",
},
page: {
type: String,
default: "1",
},
as_wide: {
type: String,
default: "1",
},
high_quality: {
type: String,
default: "1",
},
danmaku: {
type: String,
default: "0",
},
})
const {
cid, aid, page, as_wide, high_quality, danmaku } = props;
const baseURL = "https://player.bilibili.com/player.html?";
const src = ref<String>(`${
baseURL}cid=${
cid}&aid=${
aid}&page=${
page}&as_wide=${
as_wide}&high_quality=${
high_quality}&danmaku=${
danmaku}`);
</script>
css Part of the code :
<style lang="scss" scoped> .iframe-box {
width: 100%;
height: 100vh;
overflow: hidden;
}
.vedio {
width: 100%;
// Because you want to hide the following tips , All add more 40px, If you want to hide controls, add more 30px
height: calc(100vh + 40px);
min-height: 300px;
position: relative;
padding: 0;
overflow: hidden;
margin: 0;
box-sizing: border-box;
.vedio-iframe {
width: 100%;
height: 100%;
border: none;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
}
</style>
final result :

Originally, I didn't remove the appearance below :

At present, I only know how to hide below , Others don't understand for the time being , Because you can't get iframe The elements in , Its style cannot be modified
边栏推荐
- jz47 礼物的最大价值(动态规划思路)
- leetcode剑指offer JZ25 合并两个排序的链表
- Set up a WordPress personal blog locally and launch it through the intranet (22)
- Tensorflow GPU installation -- 056
- [no need for public IP] configure a fixed public TCP port address for remote desktop raspberry pie
- MeterSphere一站式开源持续测试平台
- MySQL数据库—SQL汇总(记得关注我!中国加油!)
- Leetcode refers to the duplicate number in the offer jz3 array
- 配置固定的远程桌面地址【内网穿透、无需公网IP】
- [222] memory overflow and location
猜你喜欢

How to build a website full of ritual sense and publish it on the public website 2-2

进程和计划任务管理

Li Kou 986. Intersection of interval lists

Remember to get the password of college student account once, from scratch

Do not rent servers, build your own personal business website (2)

IP课总结(3)

IP笔记(6)

IP作业(6)

Ia class summary (1)
![[no need for public IP] configure a fixed public TCP port address for remote desktop raspberry pie](/img/85/dec6a66dd10c35e2519bd240c05de1.png)
[no need for public IP] configure a fixed public TCP port address for remote desktop raspberry pie
随机推荐
IP笔记(10)
IP作业(2)RIP
LVM与磁盘配额
【222】内存溢出及定位
力扣986.区间列表的交集
Public access intranet IIS website server [no public IP required]
Hololens 2 development: development environment deployment
IP笔记(7)
MySQL from basic to entry to high availability
LuckyFrameWeb测试平台(一款支持接口自动化、WEB UI自动化、APP自动化,并且支持分布式测试的全纬度免费开源测试平台)
【测试工具】
First knowledge of graphics
Remember to get the password of college student account once, from scratch
IP notes (6)
Machine learning & deep learning introduction information sharing summary
不租服务器,自建个人商业网站(3)
IP笔记(6)
TensorFlow-GPU 安装 -- 056
IP job (2) rip
Jenkins自动化无人值守运行(上/下)