Preparation
1, install Java: http://www.java.com/zh_CN/ first
2, download and install the official website: http://www.wowza.com/pricing/installer, you need to enter the user name mailbox and other information to obtain a trial activation code
3, download Eclipse: https://www.eclipse.org/downloads/, optional, if you do not need server encoding for permission control and other operations can not
4, Web player, flowplayer: http://flash.flowplayer.org/download/, Flash Player supporting Streaming Media
Installation (in Windows)
After installing Java, install the file downloaded in step 2. You will be asked to enter the serial number in the middle. You can find it in the email address you entered during the download (if you can activate it yourself, please contact me). Enter the user name and password, which is the account that enters the management console after installation. Remember.
After the installation is complete, the console should be automatically opened (web version, similar to the administrator interface of the router). The address is generally http: // localhost: 8088
Start and Stop
Installation Directory:/Wowza Streaming Engine 4.0.1/bin/, shutdown. bat is to close the service, startup. bat is to start the service. after starting the service, you must check whether the service [WowzaStreamingEngine401] is started. If not, manually start the service.
After it is started, you can go to the console: http: // localhost: 8088 to preview the default application. Two of them are live and the other is vod. You can see the relevant playback code, this won't be replaced.
Playing Port
Generally, the playback Port is 1935 when it is installed. You can change the <Port> node in the [installation directory/Wowza Streaming Engine 4.0.1/conf/VHost.html] and restart it.
Create Application
Here, the Application is similar to a website, and a configuration file corresponds to an Application.
1. Create an Application on the console
Go to http: // localhost: 8088 and switch to the Application tag. Click Create and enter a name to quickly create an Application. After the creation is complete, go to the editing page and explain the related options in detail, that is, options such as live streaming, on-demand streaming, and video format. The most important option is the Content Directory item, this indicates the directory in which you want to put the video files related to the Application, and then all your video files will be put in.
2. Create an Application in the resource manager.
Go to the [installation directory/Wowza Streaming Engine 4.0.1/conf/] to create a folder. It is best to use an English name. I have not tried Chinese. I am not sure, and then copy the Application under con/vod. xml file.
You can open the Application. xml file to modify the configuration. After that, restart.
Application. xml
Several frequently used modification options:
AllowDomains node: domain control.
StorageDir node: The Content Directory in the console, which is used to store directories of related video files.
Modules node: Used to add the server HttpModule processing class (java) for the current Application ).
Webpage playback
After the server is ready, you can use the player to play the video on your website. Here, we will use the Player Plug-in provided by flowplayer for the time being.
Play Disk Files: http://flash.flowplayer.org/plugins/streaming/httpstreaming.html
You can view different playback paths by viewing the TestPlayers of http: // localhost: 8088. Here we use Adobe HDS, which is described in detail in the link of the previous line, here we only show the core code:
The first line is a placeholder that specifies the player size and other information. You can also place a background image. In case of a webpage error, it is not too pessimistic.
The second line is your video address, and the parameters at the end are used to write code control permissions in HttpModule. You can leave this parameter empty if you do not need it.
For the meanings of other parameters and more APIs, see the documentation.
Another RTMP playing method is similar to this one. Please read the document by yourself.
Attach my HTML code attachment
HttpModule (server code)
As mentioned earlier, domain control can be used for anti-leech protection, but permission control in the system requires you to write relevant code on your own.
1. Open the installation directory:/Wowza Streaming Engine 4.0.1/lib. Here are some of his default packages. We will also write them here later.
2, open Eclipse, new Java project (com. company. project. video), reference the three external packages under the directory just now: wms-server.jar, wms-core.jar, log4j-1.2.17.jar
3. Create a new class, for example, Authorize. java.
4. inherit ModuleBase
5. Implementation-related methods. For example, if I use httpstreaming to play the video, the onHTTPSessionCreate method is implemented, so every request to the server will be filtered in this class.
The Code is as follows:
Authorize getLogger().info("zzjj 8 onAppStart: " String fullname = appInstance.getApplication().getName() + "/" + getLogger().info("zzjj 8 onAppStart: " + getLogger().info("zzjj 8 onConnect" getLogger().info("zzjj 8 onConnectAccept: " getLogger().info("zzjj 8 onConnectReject: " getLogger().info("zzjj 8 onDisconnect: " isGood = String queryStr = httpSession.getQueryStr() + "" String[] auths = queryStr.split("&" String streamName = getLogger().info("zzjj 8 " + getLogger().info("zzjj 8 ModuleAccessControlHTTPStreaming.onHTTPSessionCreate["+streamName+"]: checking" (auths != && auths.length == 2 (streamName.indexOf(auths[0])!=0 isGood = isGood = getLogger().info("zzjj 8 ModuleAccessControlHTTPStreaming.onHTTPSessionCreate["+streamName+"]: accept:"+ (! }
Line 1 starts with the core code. The logic implemented here is: you can only view files starting with the input username; otherwise, it is not allowed.
6. Export the JAR package. For example, the exported package is com. company. project. video. jar.
7. Copy the JAR package to the installation directory:/Wowza Streaming Engine 4.0.1/lib.
8. Open the Application. xml file of the Application for Permission control, jump to the Modules node, and add a subnode:
Authorize Check if user has authority to access current file. .Authorize
In this way, each network request enters your Module for filtering.
Related logs are output to the installation directory:/Wowza Streaming Engine 4.0.1/logs to view your debugging information.
Other supplements
Wowza Chinese Forum: http://www.wowza.cn/There are also relevant tutorials and instructions.
I just got in touch with this thing yesterday. After a long time, I finally knew what was going on. Mark it. please correct me if there are any mistakes.