Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 性盈盈影院免费视频观看在线一区 ,中文字幕不卡,最近中文字幕视频在线资源

          整合營(yíng)銷服務(wù)商

          電腦端+手機(jī)端+微信端=數(shù)據(jù)同步管理

          免費(fèi)咨詢熱線:

          發(fā)視頻、圖文沒素材?不妨看看這個(gè)

          發(fā)視頻、圖文沒素材?不妨看看這個(gè)

          天給大家整理了一些 素材網(wǎng)站 讓大家更好通過各種計(jì)劃.

          圖片素材庫(kù)


          國(guó)內(nèi):


          https://huaban.com


          http://699pic.com


          https://www.58pic.com


          百度圖片



          國(guó)外:

          https://pixabay.com

          https://unsplash.com

          https://gratisography.com/page/3/

          https://cn.freeimages.com/image

          https://www.freepik.com

          https://foter.com

          https://visualhunt.com

          https://www.inspirationde.com/

          視頻素材庫(kù)

          https://pixabay.com/zh/videos/

          https://mixkit.co/videos/

          https://gaiamount.com

          https://www.filmstocks.com/c/effects-filmora-effects.html

          https://www.skypixel.com/tags?group=equipment

          音頻素材庫(kù)


          https://www.free-stock-music.com/search.php?cat=&mood=&license=&bpm=&length=&keyword=


          http://www.aigei.com/

          https://audionautix.com/

          https://www.audiolibrary.com.co/

          https://www.youtube.com/audiolibrary/music

          字體素材庫(kù)

          國(guó)內(nèi)無(wú)授權(quán)免費(fèi)的商用字體:思源字體、站酷字體、瀨戶字體、龐門正道標(biāo)題本、手書體中文簡(jiǎn)體、阿里巴巴普惠體

          https://www.zcool.com.cn

          站長(zhǎng)之家—站長(zhǎng)素材

          片頭素材庫(kù)

          https://panzoid.com/tools/clipmaker

          使用時(shí)下載谷歌翻譯插件,將網(wǎng)站的英文翻譯成中文,便于實(shí)操。

          視頻解析網(wǎng)站:

          https://youtube.iiilab.com/

          http://www.tutujiexi.com/kuaishou.html

          語(yǔ)音轉(zhuǎn)字幕

          https://www.iflyrec.com/

          https://jianwai.netease.com/

          語(yǔ)音合成

          https://www.data-baker.com/tts.html

          學(xué)習(xí)資源網(wǎng)站:

          https://www.doyoudo.com

          http://www.syseen.com(用QQ瀏覽器打開)

          高清電影 電視劇 網(wǎng)站:


          https://gaoqing.fm/


          http://www.btdx8.com/


          http://www.yournextfilm.com/us/


          http://gaoqing.la/


          http://www.bttt.la/


          http://neets.cc/found


          http://www.ttmeiju.com/


          http://www.zimuku.net/


          http://keepvid.com/


          http://www.mtime.com/trailer/trailer/


          http://yugaopian.cn/


          http://www.imdb.com/


          http://www.btbtdy.com/


          http://www.hao4k.com/


          http://ww手機(jī),電腦找尋優(yōu)質(zhì)素材


          找圖片

          手機(jī)的壁紙軟件

          花瓣

          https://huaban.com/

          站酷

          https://www.zcool.com.cn/

          千圖

          https://www.58pic.com/

          有的圖片需要會(huì)員

          千庫(kù)網(wǎng)

          https://588ku.com/

          缺點(diǎn):有的圖片需要會(huì)員

          堆糖

          https://www.duitang.com/

          Pexels

          https://www.pexels.com/

          缺點(diǎn):只支持英文搜圖。

          500PX

          https://web.500px.com/

          缺點(diǎn):雖然支持中文,但是采用中文進(jìn)行搜索準(zhǔn)確率太低。

          找文案

          微博,知乎,簡(jiǎn)書,天涯,小紅書,貼吧,豆瓣,公眾號(hào),各大自媒體平臺(tái)(頭條號(hào),大魚號(hào),企鵝號(hào))等

          抖音拍

          拍同款

          翻拍

          數(shù)英網(wǎng)(市場(chǎng)營(yíng)銷、廣告?zhèn)髅健?chuàng)意設(shè)計(jì)、電商、移動(dòng)互聯(lián)網(wǎng)等)

          https://www.digitaling.com/

          頂尖文案(全球范圍內(nèi)最優(yōu)秀的創(chuàng)意資訊)

          https://www.topys.cn/

          廣告門(是中國(guó)廣告?zhèn)鞑バ袠I(yè)領(lǐng)先在線媒體及產(chǎn)業(yè)互動(dòng)資訊服務(wù)平臺(tái))

          https://www.adquan.com/

          梅花網(wǎng)(營(yíng)銷者的信息中心)

          https://www.meihua.info/

          中華廣告網(wǎng)(國(guó)內(nèi)最專業(yè)的廣告行業(yè)門戶網(wǎng)站)

          http://www.a.com.cn/index.html

          SocialBeta (社交媒體和數(shù)字營(yíng)銷內(nèi)容)

          https://socialbeta.com/

          商業(yè)洞察(品牌行銷廣告創(chuàng)意)

          https://www.motive.com.tw/

          廣告最好看(視頻廣告文案)

          https://zhk8.com/

          我是文案(文案案例、文案新聞、文案寫作)

          http://copywrite-tw.com/

          找視頻

          bilibili b站(動(dòng)漫,2次元)

          騰訊,愛奇藝,優(yōu)酷等各大平臺(tái)

          瘋狂影視

          http://ifkdy.com/

          搜索全網(wǎng)電影電視的影視搜素引擎

          視屏資源網(wǎng)站

          www.ygdy8.com

          80s

          茶狐杯

          https://www.cupfox.com/

          中國(guó)最大的影視資源聚合搜索引擎

          手機(jī)實(shí)操

          微信搜索 西果工具小程序

          可去抖音水印

          迅雷下載

          安卓可用

          手機(jī)

          手機(jī)自帶的軟件

          電腦實(shí)操

          瀏覽器上

          bianlu1

          貓抓,適合抓音頻(抓語(yǔ)音,音樂)不適合抓視頻

          邊播邊錄

          手機(jī)上面沒有貓抓,在QQ瀏覽器上面有“資源嗅探”可以抓取語(yǔ)音和音樂

          語(yǔ)言合成(標(biāo)貝科技)

          https://www.data-baker.com/

          錄屏

          電腦

          ev錄屏

          http://xinzhi.wenda.so.com/a/1547632721203232

          手機(jī),電腦找尋優(yōu)質(zhì)素材

          找圖片

          手機(jī)的壁紙軟件

          花瓣

          https://huaban.com/

          站酷

          https://www.zcool.com.cn/

          千圖

          https://www.58pic.com/

          有的圖片需要會(huì)員

          千庫(kù)網(wǎng)

          https://588ku.com/

          缺點(diǎn):有的圖片需要會(huì)員

          堆糖

          https://www.duitang.com/

          Pexels

          https://www.pexels.com/

          缺點(diǎn):只支持英文搜圖。

          500PX

          https://web.500px.com/

          缺點(diǎn):雖然支持中文,但是采用中文進(jìn)行搜索準(zhǔn)確率太低。

          找文案

          微博,知乎,簡(jiǎn)書,天涯,小紅書,貼吧,豆瓣,公眾號(hào),各大自媒體平臺(tái)(頭條號(hào),大魚號(hào),企鵝號(hào))等

          抖音拍

          拍同款

          翻拍

          數(shù)英網(wǎng)(市場(chǎng)營(yíng)銷、廣告?zhèn)髅健?chuàng)意設(shè)計(jì)、電商、移動(dòng)互聯(lián)網(wǎng)等)

          https://www.digitaling.com/

          頂尖文案(全球范圍內(nèi)最優(yōu)秀的創(chuàng)意資訊)

          https://www.topys.cn/

          廣告門(是中國(guó)廣告?zhèn)鞑バ袠I(yè)領(lǐng)先在線媒體及產(chǎn)業(yè)互動(dòng)資訊服務(wù)平臺(tái))

          https://www.adquan.com/

          梅花網(wǎng)(營(yíng)銷者的信息中心)

          https://www.meihua.info/

          中華廣告網(wǎng)(國(guó)內(nèi)最專業(yè)的廣告行業(yè)門戶網(wǎng)站)

          http://www.a.com.cn/index.html

          SocialBeta (社交媒體和數(shù)字營(yíng)銷內(nèi)容)

          https://socialbeta.com/

          商業(yè)洞察(品牌行銷廣告創(chuàng)意)

          https://www.motive.com.tw/

          廣告最好看(視頻廣告文案)

          https://zhk8.com/

          我是文案(文案案例、文案新聞、文案寫作)

          http://copywrite-tw.com/

          找視頻

          bilibili b站(動(dòng)漫,2次元)

          騰訊,愛奇藝,優(yōu)酷等各大平臺(tái)

          瘋狂影視w.viphd.co/

          為52題需要?jiǎng)?chuàng)建一個(gè)web 后臺(tái),并開發(fā)一個(gè)客戶端來(lái)請(qǐng)求,并在界面顯示。

          涉及到internet web 請(qǐng)求相關(guān)的內(nèi)容。

          如下題目,實(shí)現(xiàn)本身很容易,但是做題的目的不純是做題,還是先做下基礎(chǔ)學(xué)習(xí)。


          翻譯下面這本書,講的不是很深,但是基本原理說(shuō)的還是很清晰的:

          https://launchschool.com/books/http/read/introduction#gettingstarted

          Introduction

          Getting Started

          If you're like most people, you've been using the internet for a long time - years, perhaps decades - and typing in those pesky URL addresses at the top of your browser, starting with the letters H, T, T, P, followed by the colon, slash, slash, w, w, w then the domain, over and over and over, yet never knowing or caring to know about what it stood for.

          HTTP is at the core of what the web is about, and also at the core of dynamic web applications. Understanding HTTP is central to understanding how modern web applications work and how they're built. This book will cover some basic concepts around HTTP, and you'll have a much better understanding of how the web and web applications work after going through it.

          翻譯:HTTP是因特網(wǎng)的核心,這本書會(huì)介紹HTTP幾個(gè)基礎(chǔ)的概念。

          Who Is This Guide For?

          This book is geared towards those who have been using the internet for a while, but have never built dynamic web applications before. It's meant for people interested in understanding how web applications work, and lays the foundational knowledge to learning more advanced web application development concepts.

          翻譯:這篇文章是為一些人,這些人已經(jīng)用了internet 很久了,不過從來(lái)沒有搭建過動(dòng)態(tài)web 應(yīng)用。為有興趣了解web 怎么工作的人,介紹一些基礎(chǔ)知識(shí),這樣可以學(xué)到更高級(jí)的web 應(yīng)用開發(fā)的概念。

          How To Read This Guide?

          Most of this book is going to be reading oriented. That is, there are not a lot of exercises, because this is mostly a book about concepts. However, where there are examples, please take time to follow along and learn by doing. There is no better way to truly understand a topic than by doing.

          翻譯:這本書沒有太多的練習(xí),主要是面向讀者。

          Background

          A Brief Overview & History

          When you type a URL into the address bar of your web browser, you expect to see the website displayed in your browser. When you click on a link, or submit a form, your browser may display the next page, or display errors in your form so you can correct them and submit again. Your browser is the interface or window, through which you interact with the world wide web.

          Under your browser's hood lies a collection of files -- CSS, HTML, Javascript, videos, images, etc. -- that makes displaying the page possible. All these files were sent from a server to your browser, the client, by an application protocol called HTTP (yes, this is why URLs in your browser address bar start with "http://").

          HTTP, or Hypertext Transfer Protocol, was invented by Tim Berners-Lee in the 1980s. It is a system of rules, a protocol, that serve as a link between applications and the transfer of hypertextdocuments. Stated differently, it's an agreement, or message format, of how machines communicate with each other. HTTP follows a simple model where a client makes a request to a server and waits for a response. Hence, it's referred to as a request response protocol. Think of the request and the response as text messages, or strings, which follow a standard format that the other machine can understand.

          The HTTP protocol has been through several changes from its inception. The protocol started in its most simplified form returning only HTML pages. In 1991, the first document version HTTP/0.9 was released. In 1992, HTTP/1.0 was released with the ability to transmit different file types like CSS documents, videos, scripts and images. 1995 saw the release of HTTP/1.1, which introduced the ability to reuse established connections for subsequent requests, among a host of other features. Further improvements made to HTTP/1.1 in 1999 resulted in what we mostly see today. The evolution of HTTP doesn't stop there though. HTTP/2 is fast gaining traction, and the latest version, HTTP/3, is currently in development.

          快速介紹背景和歷史:

          瀏覽器這個(gè)帽子底下,藏著一堆文件:CSS、HTML、javascript,video,images 等等。這些內(nèi)容都是從一個(gè)服務(wù)器發(fā)送到你的瀏覽器上的。(瀏覽器又叫客戶端) HTTP 就是一個(gè)請(qǐng)求回復(fù)的協(xié)議。可以把請(qǐng)求回復(fù)理解為 用文本信息、字符串 進(jìn)行傳輸,以機(jī)器語(yǔ)言來(lái)返回。

          1992 年 HTTP/1.0 能夠傳輸不同的文件類型,比如CSS、Videos,scriptes、images. 1995 年 HTTP/1.1 開始能夠重復(fù)使用已經(jīng)建立的鏈接,進(jìn)行隨后的請(qǐng)求。

          1999年的 HTTP/1.1 更新版本 基本就是我們現(xiàn)在看到的版本。 目前HTTP/2 正在快速獲得大眾支持。

          How the Internet Works

          The Internet consists of millions of interconnected networks that allow all sorts of computers and devices to communicate with each other. By convention, all devices that participate in a network are provided unique labels. The general term for this type of label is an Internet Protocol Address or IP Address and is similar to a computer's phone number on the Internet. Port numbers add more detail about how to communicate (think of company phone extensions). IP Addresses are represented as:

          192.168.0.1

          When a port number is needed, the address is specified as:

          192.168.0.1:1234

          where the IP Address is 192.168.0.1 and the port number is 1234. An IP Address acts as the identifier for a device or server, which can contain hundreds or thousands of ports, each used for a different communication purpose to that device or server.

          When it comes to the wider Internet, effective communication begins when each device has a public IP address provided by an Internet Service Provider. But what about an address like http://www.google.com? How does your computer know what IP address it's mapped to? When we wish to connect to Google's main page, we do not type in the IP Address, we type in its URL.

          internet 如何工作

          翻譯:這里介紹了IP地址的工作原理,其中IP地址類似電話號(hào)碼,端口號(hào)同一個(gè)電話號(hào)碼中不同的用途方式。

          DNS

          This mapping from URL to IP address is handled by the Domain Name System or DNS. DNS is a distributed database which translates domain names like www.google.com to an IP address, so that the IP address can then be used to make a request to the server. Stated differently, it keeps track of domain names and their corresponding IP addresses on the Internet. So an address like www.google.com might be resolved to an IP address 197.251.230.45.

          By the way, you can also get to Google's main page by typing the IP address into your browser's address bar. However, most people want to use a user-friendly address like www.google.com, instead of memorizing a number of digits. DNS databases are stored on computers called DNS servers. It is important to know that there is a very large world-wide network of hierarchically organized DNS servers, and no single DNS server contains the complete database. If a DNS server does not contain a requested domain name, the DNS server routes the request to another DNS server up the hierarchy. Eventually, the address will be found in the DNS database on a particular DNS server, and the corresponding IP address will be used to receive the request.

          Your typical interaction with the Internet starts with a web browser when you:

          Enter a URL like http://www.google.com into your web browser's address bar.

          The browser creates an HTTP request, which is packaged up and sent to your device's network interface.

          If your device already has a record of the IP address for the domain name in its DNS cache, it will use this cached address. If the IP address isn't cached, a DNS request will be made to the Domain Name System to obtain the IP address for the domain.

          The packaged-up HTTP request then goes over the Internet where it is directed to the server with the matching IP address.

          The remote server accepts the request and sends a response over the Internet back to your network interface which hands it to your browser.

          Finally, the browser displays the response in the form of a web page.

          The above set of steps is a simplification of what happens at a technical level. The main thing to understand though is that when your browser issues a request, it's simply sending some text to an IP address. Because the client (web browser) and the server (recipient of the request) have an agreement, or protocol, in the form of HTTP, the server can take apart the request, understand its components and send a response back to the web browser. The web browser will then process the response strings into content that you can understand. Navigating to websites like Facebook, Google and Twitter means you've been using HTTP all along. The details were hidden, but your browser was issuing the requests and processing the responses automatically. The different parts of the Internet look something like:

          翻譯:

          這里介紹了DNS的概念,DNS 是一個(gè)分布式的數(shù)據(jù)庫(kù),做 域名 和 IP地址的互相翻譯。

          這里介紹,DNS 其實(shí)是一堆服務(wù)器,通過不同的層級(jí)來(lái)控制規(guī)模。(感興趣的讀者可以了解下,一級(jí)域名、二級(jí)域名 等概念,)

          當(dāng)打開internet 瀏覽器,正常的處理邏輯如下:

          1. 在瀏覽器鍵入一個(gè)url 。http://www.google.com

          2. 瀏覽器創(chuàng)建一個(gè)HTTP請(qǐng)求,并封裝好后發(fā)到個(gè)人設(shè)備(比如手機(jī))的網(wǎng)卡上。

          3. 如果網(wǎng)卡已經(jīng)緩存了這個(gè)域名(www.goolge.com)中的IP,他會(huì)直接使用緩存的地址。否則向域名系統(tǒng)獲取這個(gè)域名對(duì)應(yīng)的地址。(譯者備注:dns 遞歸查詢)

          4. 打包好的HTTP請(qǐng)求會(huì)直接向擁有這個(gè)地址的服務(wù)器發(fā)送。

          5. 遠(yuǎn)程的服務(wù)器接受了這個(gè)請(qǐng)求,并通過internet 返回一個(gè)包到你的個(gè)人設(shè)備(比如手機(jī))的網(wǎng)卡上,網(wǎng)卡傳回給你的瀏覽器。

          6. 最后瀏覽器已web 界面的方式展現(xiàn)了回復(fù)。

          上面的步驟是從技術(shù)層層面一個(gè)簡(jiǎn)單的描述。internet 不同的部分就如下圖一樣。


          Clients and Servers

          The most common client is an application you interact with on a daily basis called a Web Browser. Examples of web browsers include Internet Explorer, Firefox, Safari and Chrome, including mobile versions. Web browsers are responsible for issuing HTTP requests and processing the HTTP response in a user-friendly manner onto your screen. Web browsers aren't the only clients around, as there are many tools and applications that can also issue HTTP requests.

          The content you're requesting is located on a remote computer called a server. Servers are nothing more than machines or devices capable of handling inbound requests, and their job is to issue a response back. Often, the response they send back contains relevant data as specified in the request.

          最常見的客戶端就是Web 瀏覽器。瀏覽器主要用來(lái)做HTTP 請(qǐng)求,以及處理HTTP 請(qǐng)求,并投放到客戶端屏幕上,瀏覽器處理后,人可以看得更清楚。

          你申請(qǐng)的文件 放在遠(yuǎn)端的電腦上,這個(gè)電腦我們叫做服務(wù)器。服務(wù)器就是處理進(jìn)來(lái)的請(qǐng)求,并返回一個(gè)答復(fù)。一般針對(duì)一個(gè)請(qǐng)求的數(shù)據(jù)都存放在回復(fù)中(response).



          Resources

          Resource is a generic term for things you interact with on the Internet via a URL. This includes images, videos, web pages and other files. Resources are not limited to files and web pages. Resources can also be in the form of software that lets you trade stock or play a video game. There is no limit to the number of resources available on the Internet.

          翻譯:資源指的是通過url從 internet 申請(qǐng)的東西。包括圖片、視頻、web 界面及其它。



          Statelessness

          A protocol is said to be stateless when it's designed in such a way that each request/response pair is completely independent of the previous one. It is important to be aware of HTTP as a stateless protocol and the impact it has on server resources and ease of use. In the context of HTTP, it means that the server does not need to hang on to information, or state, between requests. As a result, when a request breaks en route to the server, no part of the system has to do any cleanup. Both these reasons make HTTP a resilient protocol, as well as a difficult protocol for building stateful applications. Since HTTP, the protocol of the internet, is inherently stateless that means web developers have to work hard to simulate a stateful experience in web applications.

          When you go to Facebook, for example, and log in, you expect to see the internal Facebook page. That was one complete request/response cycle. You then click on the picture -- another request/response cycle -- but you do not expect to be logged out after that action. If HTTP is stateless, how did the application maintain state and remember that you already input your username and password? In fact, if HTTP is stateless, how does Facebook even know this request came from you, and how does it differentiate data from you vs. any other user? There are tricks web developers and frameworks employ to make it seem like the application is stateful, but those tricks are beyond the scope of this book. The key concept to remember is that even though you may feel the application is stateful, underneath the hood, the web is built on HTTP, a stateless protocol. It's what makes the web so resilient, distributed, and hard to control. It's also what makes it so difficult to secure and build on top of.

          如果某協(xié)議每一個(gè) request/response 和前一個(gè)request/response 完全是獨(dú)立的,這個(gè)協(xié)議被認(rèn)為是無(wú)狀態(tài)的:非常重要需要了解HTTP是一個(gè)無(wú)狀態(tài)協(xié)議(敲黑板),HTTP 對(duì)服務(wù)器資源有影響,以及易用性的影響。

          HTTP里面,服務(wù)器不需要在客戶端requests請(qǐng)求之間維持住信息、或者狀態(tài)。這樣的話,當(dāng)客戶端一個(gè)請(qǐng)求沒有到達(dá)服務(wù)器,系統(tǒng)不需要做任何清理。

          這些原因讓HTTP變成一個(gè)有彈性的協(xié)議,如果需要?jiǎng)?chuàng)建有狀態(tài)的應(yīng)用,也是一個(gè)比較復(fù)雜的協(xié)議。(敲黑板,不是不能用http做有狀態(tài)的應(yīng)用,只是比較復(fù)雜

          有一些技巧,讓框架開發(fā)者讓用戶看起來(lái)web 應(yīng)用是有狀態(tài)的。

          你需要記住的是,有狀態(tài)web應(yīng)用的帽子底下,創(chuàng)建在HTTP 上,一個(gè)無(wú)狀態(tài)協(xié)議上。也是因?yàn)檫@點(diǎn),web 業(yè)務(wù)非常的有彈性、分布式而且很難控制,另外也很難實(shí)現(xiàn)安全

          summary

          This chapter covered an oversimplified interpretation of how the Internet works along with an explanation of a few key terms. You also learned about statelessness and how it impacts web applications. We'll take a closer look at what an address such as http://www.google.com is and what it's made up of in the next chapter.

          翻譯:本章包含了一些基本的理解 inernet 怎么工作,你也了解到了無(wú)狀態(tài) 的含義,以及他對(duì) web 應(yīng)用的影響。

          在前面

          現(xiàn)在視頻業(yè)務(wù)越來(lái)越流行了,播放器也比較多,作為前端工程師如何打造一個(gè)屬于自己的播放器呢?最快最有效的方式是基于開源播放器深度定制,至于選擇哪個(gè)開源播放器仁者見仁智者見智,可以參考開源播放器列表(https://www.awesomes.cn/subject/videos)選擇適合自己業(yè)務(wù)的播放器。

          我們的播放器選擇了排名第一的video.js播放器,截至目前該播放器在Github擁有13,991 star, 4,059 fork,流行程度可見一斑。為了讓大家更多的了解它,我們細(xì)數(shù)下優(yōu)點(diǎn):

          1. 免費(fèi)開源

            這個(gè)意味著什么就不多說(shuō)了,附上項(xiàng)目地址(https://github.com/videojs/video.js)

          2. 兼容主流瀏覽器

            在國(guó)內(nèi)的前端開發(fā)環(huán)境往往需要支持到低級(jí)版本的IE瀏覽器,然后隨著Flash的退化,很多公司沒有配備Flash開發(fā)工程師,video.js提供了流暢的Flash播放器,而且在UI層面做到了和video的效果,實(shí)屬難得,比如全屏。

          3. UI自定義

            不管開源項(xiàng)目在UI方面做的如何漂亮,對(duì)于各具特色的業(yè)務(wù)來(lái)說(shuō)都要自定義UI,一個(gè)方便簡(jiǎn)單的自定義方式顯得格外重要,更何況它還自帶了編譯工具,只能用一個(gè)”贊“字形容。具體怎么實(shí)現(xiàn)的,這里先簡(jiǎn)單描述下是使用JavaScript(es6)構(gòu)建對(duì)象,通過Less編寫樣式規(guī)則,最后借助Grunt編譯。

          4. 靈活插件機(jī)制

            video.js提供一個(gè)插件定義的接口,使插件開發(fā)簡(jiǎn)單易行。而且社區(qū)論壇也提供了一些好用的插件供開發(fā)者使用。附插件列表

          5. 比較完善的文檔

            完善的文檔對(duì)于一個(gè)穩(wěn)定的開源項(xiàng)目是多么的重要,video.js提供了教程、API文檔、插件、示例、論壇等。官方地址

          6. 項(xiàng)目熱度

            開源作者對(duì)項(xiàng)目的維護(hù)比較積極,提出的問題也能很快給予響應(yīng)。開發(fā)者在使用過程中出現(xiàn)問題算是有一定保障。

          書歸正傳,要想更自由的駕馭video.js,必然要了解內(nèi)部原理。本文的宗旨就是通過核心代碼演示講解源碼運(yùn)行機(jī)制,如果有興趣,不要離開,我們馬上開始了……

          組織結(jié)構(gòu)

          由于源碼量較大,很多同學(xué)不知道從何入手,我們先來(lái)說(shuō)下它的組織結(jié)構(gòu)。

          其中control-bar,menu,popup,slider,tech,tracks,utils是目錄,其他是文件。video.js是個(gè)非常優(yōu)秀的面向?qū)ο蟮牡湫停械腢I都是通過JavaScript對(duì)象組織實(shí)現(xiàn)的。

          video.js是個(gè)入口文件,看源碼可以從這個(gè)文件開始。

          setup.js處理播放器的配置安裝即data-setup屬性。

          poster-image.js處理播放器貼片。

          plugins.js實(shí)現(xiàn)了插件機(jī)制。

          player.js構(gòu)造了播放器類也是video.js的核心。

          modal-dialog.js處理彈層相關(guān)。

          media-error.js定義了各種錯(cuò)誤描述,如果想理解video.js對(duì)各語(yǔ)言的支持,這個(gè)文件是必看的,它是橋梁。

          loading-spinner.js實(shí)現(xiàn)了播放器加載的標(biāo)志,如果不喜歡默認(rèn)加載圖標(biāo)在這里修改吧。

          fullscreen-api.js實(shí)現(xiàn)各個(gè)瀏覽器的全屏方案。

          extend.js是對(duì)node 繼承 and babel's 繼承的整合。

          event-target.js 是event類和原生事件的兼容處理。

          error-display.js 主要處理展示錯(cuò)誤的樣式設(shè)置。

          component.js 是video.js框架中最重要的類,是所有類的基類,也是實(shí)現(xiàn)組件化的基石。

          close-button.js 是對(duì)關(guān)閉按鈕的封裝,功能比較單一。

          clickable-component.js 如果想實(shí)現(xiàn)一個(gè)支持點(diǎn)擊事件和鍵盤事件具備交互功能的組件可以繼承該類,它幫你做了細(xì)致的處理。

          button.js 如果想實(shí)現(xiàn)一個(gè)按鈕了解下這個(gè)類是必要的。

          big-play-button.js 這個(gè)按鈕是視頻還未播放時(shí)顯示的按鈕,官方將此按鈕放置在播放器左上角。

          utils目錄顧名思義是一些常用的功能性類和函數(shù)。

          tracks目錄處理的是音軌、字幕之類的功能。

          tech目錄也是非常核心的類,包括對(duì)video封裝、flash的支持。

          slider目錄主要是UI層面可拖動(dòng)組件的實(shí)現(xiàn),如進(jìn)度條,音量條都是繼承的此類。

          popup目錄包含了對(duì)彈層相關(guān)的類。

          menu目錄包含了對(duì)菜單UI的實(shí)現(xiàn)。

          control-bar目錄是非常核心的UI類的集合了,播放器下方的控制器都在此目錄中。

          通過對(duì)組織結(jié)構(gòu)的描述,大家可以,想了解video.js的哪一部分內(nèi)容可以快速入手。如果還想更深入的了解如何正確使用這些類,請(qǐng)繼續(xù)閱讀繼承關(guān)系一節(jié)。

          繼承關(guān)系

          video.js是JavaScript面向?qū)ο髮?shí)現(xiàn)很經(jīng)典的案例,你一定會(huì)好奇在頁(yè)面上一個(gè)DOM節(jié)點(diǎn)加上data-setup屬性簡(jiǎn)單配置就能生成一個(gè)復(fù)雜的播放器,然而在代碼中看不到對(duì)應(yīng)的HTML”模板“。其實(shí)這都要?dú)w功于”繼承“關(guān)系以及作者巧妙的構(gòu)思。

          在組織結(jié)構(gòu)一節(jié)有提到,所有類的基類都是Component類,在基類中有個(gè)createEl方法這個(gè)就是JavaScript對(duì)象和DOM進(jìn)行關(guān)聯(lián)的方法。在具體的類中也可以重寫該方法自定義DOM內(nèi)容,然后父類和子類的DOM關(guān)系也因JavaScript對(duì)象的繼承關(guān)系被組織起來(lái)。

          為了方便大家查閱video.js所有的繼承關(guān)系,整理了兩個(gè)圖表,一個(gè)是完整版,一個(gè)是核心版。

          • 完整版

          • 核心板

          運(yùn)行機(jī)制

          video.js源碼代碼量比較大,我們要了解它的運(yùn)行機(jī)制,首先確定它的主線是video.js文件的videojs方法,videojs方法調(diào)用player.js的Player類,Player繼承component.js文件的Component類,最后播放器成功運(yùn)行。

          我們來(lái)看下videojs方法的代碼、Player的構(gòu)造函數(shù)、Component的構(gòu)造函數(shù),通過對(duì)代碼的講解基本整個(gè)運(yùn)行機(jī)制就有了基本的了解,注意里面用到的所有方法和其他類對(duì)象參照組織結(jié)構(gòu)一節(jié)細(xì)細(xì)閱讀就可以掌握更多的運(yùn)行細(xì)節(jié)。

          • videojs方法

          • Player的構(gòu)造函數(shù)

          • Component的構(gòu)造函數(shù)

          這里通過主線把基本的流程演示一下,輪廓出來(lái)了,更多細(xì)節(jié)還請(qǐng)繼續(xù)閱讀。

          插件機(jī)制

          一個(gè)完善和強(qiáng)大的框架都會(huì)繼承插件運(yùn)行功能,給更多的開發(fā)者參與開發(fā)的機(jī)會(huì)進(jìn)而實(shí)現(xiàn)框架功能的補(bǔ)充和延伸。我們來(lái)看下video.js的插件是如何運(yùn)作的。

          • 插件的定義

          如果之前用過video.js插件的同學(xué)或者看過插件源碼,一定有看到有這句話videojs.plugin=pluginName,我們來(lái)看下源碼:

          不難看出,原理就是將插件(函數(shù))掛載到Player對(duì)象的原型上,接下來(lái)看下是怎么執(zhí)行的。

          • 插件的運(yùn)行

          在Player的構(gòu)造函數(shù)里判斷是否有插件這個(gè)配置,如果有則遍歷執(zhí)行。

          UI"繼承"的原理

          在繼承關(guān)系一節(jié)中有提到video.js的所有DOM生成都不是采用的傳統(tǒng)模板的方式,都是通過JavaScript對(duì)象的繼承關(guān)系來(lái)實(shí)現(xiàn)的。

          在Component基類中有個(gè)createEl方法,在這里可以使用DOM類生成DOM實(shí)例。每個(gè)UI類都會(huì)有一個(gè)el屬性,會(huì)在實(shí)例化的時(shí)候自動(dòng)生成,源代碼在Component的構(gòu)造函數(shù)中:

          每個(gè)UI類有一個(gè)children屬性,用于添加子類,子類有可能扔具有children屬性,以此類推,播放器的DOM結(jié)構(gòu)就是通過這樣的JavaScript對(duì)象結(jié)構(gòu)實(shí)現(xiàn)的。

          在Player的構(gòu)造函數(shù)里有一句代碼this.initChildren();啟動(dòng)了UI的實(shí)例化。這個(gè)方法是在Component基類中定義的,我們來(lái)看下:

          通過這段代碼不難看出大概的意思是通過initChildren獲取children屬性,然后遍歷通過addChild將子類實(shí)例化,實(shí)例化的過程會(huì)自動(dòng)重復(fù)上述過程從而達(dá)到了”繼承“的效果。不得不為作者的構(gòu)思點(diǎn)贊。如果你要問并沒看到DOM是怎么關(guān)聯(lián)起來(lái)的,請(qǐng)繼續(xù)看addChild方法的源碼:

          這段代碼的大意就是提取子類的名稱,然后獲取類并實(shí)例化,最后通過最關(guān)鍵的一句話this.contentEl().insertBefore(component.el(), refNode);完成了父類和子類的DOM關(guān)聯(lián)。相信inserBefore大家并不陌生吧,原生的DOM操作方法。

          總結(jié)

          至此,video.js的精華部分都描述完了,不知道大家是否有收獲。這里簡(jiǎn)單的總結(jié)一些閱讀video.js框架源碼的心得:

          1. 找準(zhǔn)播放器實(shí)現(xiàn)的主線流程,方便我們有條理的閱讀代碼

          2. 了解框架代碼的組織結(jié)構(gòu),有的放矢的研究相關(guān)功能的代碼

          3. 理解類與類的繼承關(guān)系,方便自己構(gòu)造插件或者修改源碼的時(shí)候知道從哪個(gè)類繼承

          4. 理解播放器的運(yùn)行原理,有利于基于Component構(gòu)造一個(gè)新類的實(shí)現(xiàn)

          5. 理解插件的運(yùn)行機(jī)制,學(xué)會(huì)自己構(gòu)造插件還是有必要的

          6. 理解UI的實(shí)現(xiàn)原理,就知道自己如何為播放器添加視覺層面的東西了

          7. 看看我的源碼解讀吧,能幫一點(diǎn)是一點(diǎn),哈哈


          主站蜘蛛池模板: 国产精品久久久久一区二区 | 亚洲一区二区三区久久| 乱色熟女综合一区二区三区| 91午夜精品亚洲一区二区三区| 精品国产一区二区三区AV| 国产99精品一区二区三区免费| 国产福利一区二区三区| 亚洲国产精品一区二区久久hs| 国产成人精品一区二三区| 亚洲国产AV一区二区三区四区| 国产亚洲情侣一区二区无| 久久国产午夜精品一区二区三区| 日韩一区二区三区精品| 在线观看国产一区二区三区| 色屁屁一区二区三区视频国产| 成人区精品一区二区不卡亚洲| 久久婷婷久久一区二区三区| 成人在线视频一区| 国产成人av一区二区三区在线 | 亚洲一区二区久久| 无码视频一区二区三区在线观看| 国99精品无码一区二区三区| 激情内射亚州一区二区三区爱妻| 国产乱码精品一区二区三区麻豆 | 精品国产免费一区二区三区| 福利一区在线视频| 国产一区三区二区中文在线| 成人区人妻精品一区二区不卡视频| 国产91精品一区二区麻豆亚洲| 手机看片福利一区二区三区| 无码毛片视频一区二区本码| 亚洲视频一区二区在线观看| 国产大秀视频在线一区二区| 中字幕一区二区三区乱码 | 亚洲av日韩综合一区在线观看| 少妇无码一区二区三区| 国产成人综合一区精品| 女女同性一区二区三区四区| 色一情一乱一伦一区二区三区日本 | 国产成人无码AV一区二区| 无码一区二区三区老色鬼|