There has always been a problem. Insus. NET wants to solve it and is busy, but cannot spare time. How can I enable my website to play MP4 videos? All of the preceding live video files are general. wmv,.flv,.avior .swfmedia videos. videos in the same format as those in MP4 cannot be implemented on the website. However, we have implemented Insus. NET last night. Now we will take some time to share this experience.
First download a Player MP4 components online: http://flowplayer.org/
Click the menu indicated by the arrow to go to another page and design your own player:
Click"Generate Player"Button, which will give you the custom player code:
1 <!doctype html> 2 3
OK ,click it. On our site, create a webpage, which is a .aspx's webpage. For example, you must give it a dynamic video, such as MP4Player. aspx, and then in the player code generated above, select the required code to copy, first copy lines 6th to 33, paste the post to MP4Player. in the
Finished? No. What else should we do? Now you need to dynamically load the video to this player, so you have to modify some code, refer:
The modified code is to remove lines 63rd to 65 and add an asp: Literal control.
Follow up with Insus. NET will play three types of videos below. The first is the MP4 video in the playing site, the second is the video of other sites, and the third is the video of non-site directories.
First, implement the first one: write a program in MP4Player. aspx. cs,
Second, you can paste other MP4 video addresses and play the video on your site. When processing these addresses, you can use the following method to determine whether the addresses are correct or exist:
Http://www.cnblogs.com/insus/archive/2013/05/03/3057029.html
Then, give the user a Warm Reminder.
In addition, Insus. NET from the following address to obtain the video address outside the test site: http://www.asp.net/web-pages/videos many MP4 video Oh !!!
The following is an example of obtaining an online video address:
After obtaining the address, we have to paste the address in the program, in MP4Player. on the aspx webpage, put a TextBox and a button. That is to say, after you paste the video address into the text box, click the button next to it to start.
Take a look at the Click playback event of. aspx. cs:
Let's take a look at the effect:
Okay, everything is the same as what we thought. Now the last method is to play MP4 videos in non-site directories? To implement this, you need to write some code. You need to convert the file into a data stream and play it back. You can create a. ashx file on the site.
After the ProcessVideoFile. ashx file is written, Insus. NET has to modify the MP4Player. aspx. cs code in four steps.
Demo:
OK.