• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] load rtmp provder if device is mobile

Started by turegardes.com,

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

turegardes.comTopic starter

   

I'm using Apache, nginx, ffmpeg and phpvibe CMS for a streaming website.

So when the device is mobile, it will load the http provider, or else is the rtmp.

I did put two different videos, but I can't find the solution to integrate or modify the phpvibe's code to do this

This is the jwplayer's code on phpvibe public function _jwplayer6 ($file,$thumb, $logo = null, $type=null) { global $video;

$embed = '<div id="video-setup" class="full">' . _lang("Loading the player...") . '</div>';
          $embed .= ' <script type="text/javascript">

    jwplayer("video-setup").setup({ primary : "html5",  file: ***"' . $file . '",***  image: "' . $thumb . '", modes: [
    { type: "html5" },
    { type: "flash", src: "' . site_url() . 'lib/players/jwplayer/player.swf" }
], stretching: "uniform",  height: ' . $this->height . ',   repeat: "always",     width: "100%"';


I try to do this

$embed .= '<script type="text/javascript" src="//wurfl.io/wurfl.js"></script><script type="text/javascript">
              if(WURFL.is_mobile){
                var SourcesConteneuse = "http'.substr($file,4).'";
              }else{  
               var SourcesConteneuse = "rtmp'.substr($file,4).'";
              } 
        jwplayer("video-setup").setup({ primary : "html5",  file : SourcesConteneuse , image : "' . $thumb . '", modes: [
        { type: "html5" },


but unfortunately jwplayer failed to load rtmp on desktops, but mobile load http

I checked the nginx and rtmp server and seems alright

So I need your help to find the correct code
  •  

PHPVibe A.

Hi!

Shouldn't it be

if(!WURFL.is_mobile){


?

Cause right now is set to load http on mobile and rtmp on others.

Did you try the actual rtmp url in source, does it work?

Here is the jwplayer docs on rtpm http://support.jwplayer.com/customer/portal/articles/1430358-using-rtmp-streaming

turegardes.comTopic starter

Hello

Now i did upgrade to phpvibe 4 i found it very helpful but i need to know how modifiy "'.$file.'"

<source src="'.$file.'" type=\'video/mp4\' /> to load rtmp:// none http://

any advise please
  •  

PHPVibe A.

Using str_replace can do it http://php.net/str_replace
$file = str_replace("http://","rtmp://",$file);

turegardes.comTopic starter

Thank you

it works so then i tried to do this
<video id="currentvideo" class="video-js vjs-default-skin" controls preload="auto" 
      poster="'.$thumb.'"
      data-setup="{}';
	  /** ICI **/
	   $embed .= '<script type="text/javascript" src="//wurfl.io/wurfl.js"></script>
<script type="text/javascript">
              if(WURFL.is_mobile){
                var SourcesConteneuse = "http'.substr($file,4).'";
             }else{  
               var SourcesConteneuse = "rtmp'.substr($file,4).'";
              } 
			  </script>';
	  /** /ici **/
    $embed .='<source id="test" src="" type=\'video/mp4\' /> 
<script type="text/javascript"> $("source#test").attr("src",SourcesConteneuse); </script>
    <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
  </video>
  <script type="text/javascript">


but i get error that


Any advise please
  •  

PHPVibe A.

Unfortunately rtmp is something I know nothing about. Maybe the jwplayer forum would be more useful on this matter. I can help with phpvibe's code...

turegardes.comTopic starter

Hi

I did install nginx as a reverse proxy with rtmp module then i add some codes to the jwplayer so now the RTMP stream will be played on desktops, the HTTP download will be played on devices.
I'm faced with a problem
error while uploading videos but i resolve it after inscresing the body header value in nginx.conf

i want to thank for you help
  •  

PHPVibe A.

Hi! Glad you've figured it out.
I've never tried nginx, so don't know how it really works. Can you give some feedback on benefits comparing to apache?

turegardes.comTopic starter

Thank you

i use apache for back-end and nginx as reverse proxy you can check this artile is helpful

https://www.codementor.io/devops/tutorial/devops-tutorial-nginx-reverse-proxy

you can check my website www.dimafabor.com where the videos streaming is rtmp

here is the source

https://github.com/arut/nginx-rtmp-module/wiki/Getting-started-with-nginx-rtmp

  •  

PHPVibe A.

Thank you!
Just a small info: your fontawesome icons are loading for me on chrome. Check that the font files are all there (or if you did some css changes).

turegardes.comTopic starter

Thank you, yes i know it's a matter with www. i will redirect it using .htacces, if you remove www. you will see the fontawesome icons (y)
  •  

PHPVibe A.

Quote from: dimafabor.com on
Thank you, yes i know it's a matter with www. i will redirect it using .htacces, if you remove www. you will see the fontawesome icons (y)

Anytime!

Similar topics (7)