JW Player无法在iOS中运行

时间:2012-12-04 12:15:21

标签: javascript html5 drupal jwplayer amazon-cloudfront

我遇到了jw播放器的问题。它在iOS(safari)中不起作用(播放器未显示)。该视频托管在带有cloudfront的s3上。它适用于Mac的Safari游戏。这是我的一段代码。

<?php 
echo media_site_play_video_media_files();

function media_site_play_video_media_files(){
   global $base_url;
  drupal_add_js(libraries_get_path('jwplayer') . '/jwplayer.js');

  $output = '<div id="video-player">ENI Video</div>';

  $flash_player_path = $base_url.'/sites/all/libraries/jwplayer/player.swf';


  $output .= "<script>
            jwplayer('video-player').setup({
             autostart: false,
              flashplayer: '".$flash_player_path."',
              width : 220,
              height: 150,
              image: '".$base_url.'/sites/all/themes/evansnewton/images/ENI Logo w Partnership Progress.png'."',
              'provider': 'rtmp',
              'streamer': 'rtmp://s22ljyq61fr9xw.cloudfront.net/cfx/st/',
              'file': 'mp4:ENICorporateUpdate09-2012016large'
            });
            </script>";
  return $output;
}
?>

1 个答案:

答案 0 :(得分:1)

惊人!!!我能够解决这个问题。刚刚发现iPAD不支持Flash播放器,我使用了模式(flash和html5),效果很好。这是新代码

<?php 
echo media_site_play_video_media_files();

function media_site_play_video_media_files(){
   global $base_url;
  drupal_add_js(libraries_get_path('jwplayer') . '/jwplayer.js');

  $output = '<div id="video-player">ENI Video</div>';

  $flash_player_path = $base_url.'/sites/all/libraries/jwplayer/player.swf';


  $output .= "<script>
            jwplayer('video-player').setup({
             autostart: false,
              flashplayer: '".$flash_player_path."',
              width : 220,
              height: 150,
              image: '".$base_url.'/sites/all/themes/evansnewton/images/ENI Logo w Partnership Progress.png'."',
              'modes': [
                {   'type': 'flash',
                    'src': '".$flash_player_path."',
                        'config': {
                            'file': 'mp4:ENICorporateUpdate09-2012016large',                            
                            'streamer': 'rtmp://s22ljyq61fr9xw.cloudfront.net/cfx/st/',
                            'provider': 'rtmp'
                        }                    
                },
                {   'type': 'html5',
                        'config': {
                            'file': 'http://eni-video.s3.amazonaws.com/ENICorporateUpdate09-2012016large.mp4'
                        }
                }
              ]
            });
            </script>";
  return $output;
}
?>