Java自学者论坛

 找回密码
 立即注册

手机号码,快捷登录

恭喜Java自学者论坛(https://www.javazxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,会员资料板块,购买链接:点击进入购买VIP会员

JAVA高级面试进阶训练营视频教程

Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程Go语言视频零基础入门到精通Java架构师3期(课件+源码)
Java开发全终端实战租房项目视频教程SpringBoot2.X入门到高级使用教程大数据培训第六期全套视频教程深度学习(CNN RNN GAN)算法原理Java亿级流量电商系统视频教程
互联网架构师视频教程年薪50万Spark2.0从入门到精通年薪50万!人工智能学习路线教程年薪50万大数据入门到精通学习路线年薪50万机器学习入门到精通教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程MySQL入门到精通教程
查看: 1004|回复: 0

OBS实现直播解决方案【html实现直播】

[复制链接]
  • TA的每日心情
    奋斗
    2024-11-24 15:47
  • 签到天数: 804 天

    [LV.10]以坛为家III

    2053

    主题

    2111

    帖子

    72万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    726782
    发表于 2021-9-2 13:05:26 | 显示全部楼层 |阅读模式

    项目的需要,要整一个视频直播,但又不想在其他平台那种直播室盗链展示,那我就直接用播放器来实现rtmp流媒体服务器推流吧!没废话,走起

     

    1.你要有一个媒体服务器,暂时用【盘古云】,这个还好,算是不错的平台了。注册就能用,貌似免费的一样,哈哈不管那么多先搭建一个,看图:

    图解:
    【1】菜单,进入创建一个媒体服务

    【2】开始创建,这里自己需要填的自己填

    【3】创建好之后,点击【更多】【高级设置】就能看到网站需要的rtmp推送地址了,留好了。开始下一步工作。

    这里服务器算是有了,那么我们要借助OBS实现推流了!走起~~

    OBS下载地址:http://www.obsapp.net/

    下载好你就安装吧!

    配置推流根据这个地址学习配置,我不赘述:http://jingyan.baidu.com/article/60ccbceb477a0764cab197f2.html

    很简单,直接中文自己能搞懂的,相信你~

    那么。上面配置完后,我们就借用免费的强大播放器玩玩

    去下载酷播:http://www.cuplayer.com/CuPlayer/download.html

    下载好之后,代码只需要改该

    CuSunV4set.xml配置文件改为:

    <CuPlayer>
      <Player_Set
         JcScpBufferTime = "3"
         JcScpVolume = "75"
         JcScpCode = "utf8"
         JcScpImgDisplay = "no"
         JcScpAutoHideControl="yes"
         JcScpControlHideTime="0.5"
         JcScpControlHeight="40"
         JcScpShowList= "yes"
         JcScpAutoRepeat = "no"
         JcScpsetMode = "1"
         JcScpAFrontCanClose = "no"
         JcScpShowRightmenu = "yes"
         JcScpShareMode = "JcScpVideoPath"
         JcScpLoadbarMode = "0"
             JcScpLiveMode  = "0"
        />
    
      <Logo_Set
      JcScpLogoDisplay = "yes"
      JcScpLogoPath = "images/logo.png"
      JcScpLogoPosition = "top-left"
      JcScpLogoWidth = "150"
      JcScpLogoHeight = "70"
      JcScpLogoAlpha = "0.5"
        />
    
      <Flashvars_Set
    JcScpServer ="rtmp://xxxxxxxxxxxxx"
    JcScpVideoPath="mp4:test.mp4"
    ShowJcScpAFront = "no"
    JcScpCountDowns = "0"
    JcScpCountDownsPosition = "top-right"
    JcScpAutoPlay = "yes"
    JcScpVideoPathHD = ""
    JcScpImg ="images/startpic.jpg"
    JcScpTitle  = "你想要的名字"
    JcScpStarTime = "0"
    JcScpEndTime = "0"
    JcScpCuePointInfo = ""
    JcScpCuePointTime = ""
             
    JcScpAFrontW = "730"
    JcScpAFrontH = "454"
    JcScpAFrontPath = ""
    JcScpAFrontLink = "/"
             
    ShowJcScpAVideo= "no"
    JcScpAVideoServer= ""
    JcScpAVideoPath= ""
    JcScpAVideoLink= "/"
            
    ShowJcScpAPause = "no"
    JcScpAPausePath = ""
    JcScpAPauseW = "300"
    JcScpAPauseH = "250"
    JcScpAPauseLink= "/"
            
    ShowJcScpACorner = "no"
    JcScpACornerPath= ""
    JcScpACornerW = "90"
    JcScpACornerH = "50"
    JcScpACornerPosition = "top-right"
    JcScpACornerLink = "/"
     
    ShowJcScpAEnd = "no"
    JcScpAEndPath = ""
    JcScpAEndW = "400"
    JcScpAEndH = "300"
    JcScpAEndLink= "/"
    
    ShowJcScpAMoveText = "no"
         />
    
      <SkinColor_Set
       JcScpBackcolor = "0x000000"
           JcScpBackcolortop = "0x353535"
           JcScpLightcolor = "0xcfcfcf"
           JcScpFontcolor = "0xffffff"
           JcScptimebg = "0x393939"
           JcScpLoadbar = "0x00a0e9"
           JcScpLoaded = "0x4d4b4b"
           JcScpLoadbg = "0x222222"
           JcScpPlayBtn = "0x2d2d2d"
           JcScpBar = "0xffffff"
         />
    </CuPlayer>

    demo14.html代码修改为:只修改Body

    <body>
        <div class="close_light_bg" id="close_light_bg"></div>
        <script type="text/javascript" src="js/swfobject.js"></script>
        <div class="video" id="CuPlayer"> <b> <img src="images/loading.gif" /> 直播加载中,请稍后...</b> </div>
        <script type="text/javascript">
            var so = new SWFObject("player.swf", "ply", "980", "460", "9", "#000000");
            so.addParam("allowfullscreen", "true");
            so.addParam("allowscriptaccess", "always");
            so.addParam("wmode", "opaque");
            so.addParam("quality", "high");
            so.addParam("salign", "lt");
            // <!-- HTML代码参数/Begin -->
            so.addVariable("JcScpFile", "CuSunV4set.xml"); //配置文件
            // <!-- HTML代码参数/End --> 
            so.write("CuPlayer");
        </script>
        <script language=javascript src="js/jquery-1.4.2.min.js" type=text/javascript></script>
        <script language=javascript src="js/action.js" type=text/javascript></script>
        <!--极酷阳光播放器/代码结束-->
        <div style="display:none;">
            <script type="text/javascript" src="http://www.cuplayer.com/CuPlayer/js/stat.js"></script>
        </div>
    </body>

    就这样完成了播放器读取流媒体服务器地址播放的全过程!

    有什么不明白的留言或者加qq:769429771

     

    哎...今天够累的,签到来了1...
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|小黑屋|Java自学者论坛 ( 声明:本站文章及资料整理自互联网,用于Java自学者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2024-12-22 00:40 , Processed in 1.026348 second(s), 29 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表