Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to play RTMP Protocol Video based on flash in HTML5

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how HTML5 plays RTMP protocol video based on flash, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.

The specific code is as follows:

Video.js 7 body {background-color: # 191919} .m {width: 640px; height: 264px; margin-left: auto; margin-right: auto; margin-top: 100px } / / set Chinese videojs.addLanguage ('zh-CN', {"Play": "play") "Pause": "pause", "Current Time": "current time", "Duration": "duration", "Remaining Time": "time remaining", "Stream Type": "Media stream type" "LIVE": "LVB", "Loaded": "loaded", "Progress": "Progress", "Fullscreen": "full screen", "Non-Fullscreen": "exit full screen" "Mute": "mute", "Unmute": "unmute", "Playback Rate": "playback speed", "Subtitles": "subtitle", "subtitles off": "close subtitle" "Captions": "embedded subtitle", "captions off": "close embedded subtitle", "Chapters": "Program paragraph", "Close Modal Dialog": "close pop-up window", "Descriptions": "description" "descriptions off": "shutdown description", "Audio Track": "Audio track", "You aborted the media playback": "Video playback is terminated", "A network error caused the media download to fail part-way.": "Network error caused video download failure." , "The media could not be loaded, either because the server or network failed or because the format is not supported.": "the video cannot be loaded due to an unsupported format or a problem with the server or network." , "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.": "playback is terminated because the video file is corrupted or the video uses a feature that your browser does not support." , "No compatible source was found for this media.": "unable to find a compatible source for this video." , "The media is encrypted and we do not have the keys to decrypt it.": "the video is encrypted and cannot be decrypted." , "Play Video": "play video", "Close": "close", "Modal Window": "pop-up window", "This is a modal window": "this is a pop-up window" "This modal can be closed by pressing the Escape key or activating the close button.": "you can press the ESC key or enable the close button to close this pop-up window." , ", opens captions settings dialog": ", open the title setting pop-up window", ", opens subtitles settings dialog": ", open the subtitle setting pop-up window", ", opens descriptions settings dialog": ", open the description setting pop-up window", ", selected": ", select" "captions settings": "subtitle setting", "Audio Player": "Audio player", "Video Player": "Video player", "Replay": "Replay", "Progress Bar": "Progress Section" "Volume Level": "Volume", "subtitles settings": "subtitle setting", "descriptions settings": "description setting", "Text": "text", "White": "White" "Black": "black", "Red": "red", "Green": "green", "Blue": "blue", "Yellow": "yellow" "Magenta": "Purple Red", "Cyan": "Green", "Background": "background", "Window": "Windows", "Transparent": "transparent" "Semi-Transparent": "translucent", "Opaque": "opaque", "Font Size": "font size", "Text Edge Style": "font edge style", "None": "none" "Raised": "embossed", "Depressed": "low", "Uniform": "uniform", "Dropshadow": "Shadow", "Font Family": "font library" "Proportional Sans-Serif": "proportion without fine body", "Monospace Sans-Serif": "single interval without fine body", "Proportional Serif": "proportional fine body", "Monospace Serif": "single spaced thin body" "Casual": "comfortable", "Script": "handwritten", "Small Caps": "small uppercase font", "Reset": "restart" "restore all settings to the default values": "restore all settings to preset values", "Done": "done", "Caption Settings Dialog": "subtitle setting window", "Beginning of dialog window. Escape will cancel and close the window. ":" start the conversation window. If you leave, you will cancel and close the window. "End of dialog window.": "end the conversation window"}); videojs.options.flash.swf = 'js/video-js.swf' / / initialize the video Set to global variable var myPlayer = videojs ('rtmpVideo', {autoplay: true, controls: true,// control bar muted: true,// mute preload: "auto", / / preload language: "zh-CN", / / initialize language playbackRates: [1, 2, 3, 4, 5, 8, 10, 20], / / playback speed' techOrder': ['flash'] Sources: [{/ * rtmp://live.hkstv.hk.lxdns.com/live/hks*/ src: 'rtmp://www.uav-space.com/vod2/uspace3.mp4', / / set your playback resources here Type: 'rtmp/flv'}]}, function () {console.log ("- successfully initialize video -") MyPlayer.one ("playing", function () {/ / listening to playback console.log ("start playing"); myPlayer.one ("error", function (error) {/ / listening to error console.error ("listening for exception, error message:% o", error);})

In addition, you may need to update flash, restart your computer after updating, and then click allow flash.

Thank you for reading this article carefully. I hope the article "how to play HTML5 protocol video based on flash" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report