{"id":227,"date":"2012-05-14T05:37:45","date_gmt":"2012-05-14T05:37:45","guid":{"rendered":"http:\/\/pixert.com\/blog\/?p=227"},"modified":"2014-06-09T05:15:39","modified_gmt":"2014-06-09T05:15:39","slug":"mp4-video-cannot-play-on-ipad-ipod-iphone-using-jw-player-shortocode","status":"publish","type":"post","link":"https:\/\/pixert.com\/blog\/mp4-video-cannot-play-on-ipad-ipod-iphone-using-jw-player-shortocode\/","title":{"rendered":"MP4 video cannot play on iPad\/iPod\/iPhone using JW Player shortcode"},"content":{"rendered":"<p>It seems that this is a bug on JW Player for WordPress plugin<br \/>\nWe added JW Player or WordPress plugin shortcode with a mp4 video in it, the video plays on Macbooks and PCs, but it shows blank on iPad or iPod or iPhone.<br \/>\nAlthough HTML5 as default mode, it doesn&#8217;t work.<\/p>\n<p>How to fix that?<br \/>\n1. Browse Media subfolder, find it inside wp-content\/plugins\/jw-player-plugin-for-wordpress<br \/>\n1. Open JWShortcode.php with PHP\/Text Editor<br \/>\n2. Find function generate_embed_code($atts) in line no 233 &#8211; 265<br \/>\n3. Replace the function code with following<\/p>\n<pre class=\"brush: php; title: Code Block; notranslate\" title=\"Code Block\">\r\nfunction generate_embed_code($atts) {\r\n  $version = version_compare(get_option(LONGTAIL_KEY . &quot;version&quot;), &quot;5.3&quot;, &quot;&gt;=&quot;);\r\n  $embedder = file_exists(LongTailFramework::getEmbedderPath());\r\n  if (preg_match(&quot;\/iP(od|hone|ad)\/i&quot;, $_SERVER&#x5B;&quot;HTTP_USER_AGENT&quot;])) {\r\n    $loaded_config = LongTailFramework::getConfigValues();\r\n    $width = isset($atts&#x5B;&quot;width&quot;]) ? $atts&#x5B;&quot;width&quot;] : $loaded_config&#x5B;&quot;width&quot;];\r\n    $height = isset($atts&#x5B;&quot;height&quot;]) ? $atts&#x5B;&quot;height&quot;] : $loaded_config&#x5B;&quot;height&quot;];\r\n    $output = '&lt;video src=&quot;' . $atts&#x5B;&quot;file&quot;] . '&quot; width=&quot;' . $width . '&quot; height=&quot;' . $height . '&quot; controls=&quot;controls&quot;&gt;&lt;\/video&gt;';\r\n    return $output;\r\n  } else {\r\n  if (!$embedder &amp;&amp; !$version) {\r\n    $youtube_pattern = &quot;\/youtube.com\\\/watch\\?v=(&#x5B;0-9a-zA-Z_-]*)\/i&quot;;\r\n    $loaded_config = LongTailFramework::getConfigValues();\r\n    $width = isset($atts&#x5B;&quot;width&quot;]) ? $atts&#x5B;&quot;width&quot;] : $loaded_config&#x5B;&quot;width&quot;];\r\n    $height = isset($atts&#x5B;&quot;height&quot;]) ? $atts&#x5B;&quot;height&quot;] : $loaded_config&#x5B;&quot;height&quot;];\r\n    $output = &quot;&quot;;\r\n    if (preg_match($youtube_pattern, $atts&#x5B;&quot;file&quot;], $match)) {\r\n      $output = '&lt;object width=&quot;' . $width . '&quot; height=&quot;' . $height . '&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http:\/\/www.youtube.com\/v\/' . $match&#x5B;1] . '&amp;amp;hl=en_US&amp;amp;fs=1&quot;&gt;&lt;\/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;\/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;\/param&gt;&lt;embed src=&quot;http:\/\/www.youtube.com\/v\/' . $match&#x5B;1] . '&amp;amp;hl=en_US&amp;amp;fs=1&quot; type=&quot;application\/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;' . $width . '&quot; height=&quot;' . $height . '&quot;&gt;&lt;\/embed&gt;&lt;\/object&gt;';\r\n    } \r\n    return $output;\r\n  } else {\r\n    if (get_option(LONGTAIL_KEY . &quot;player_location_enable&quot;)) {\r\n      $swf = LongTailFramework::generateSWFObject($atts, $embedder, get_option(LONGTAIL_KEY . &quot;player_location&quot;));\r\n    } else {\r\n      $swf = LongTailFramework::generateSWFObject($atts, $embedder);\r\n    }\r\n    if (!get_option(LONGTAIL_KEY . &quot;use_head_js&quot;)) {\r\n      insert_embedder($embedder);\r\n    }\r\n    return $swf-&gt;generateEmbedScript();\r\n  }\r\n  }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It seems that this is a bug on JW Player for WordPress plugin We added JW Player or WordPress plugin shortcode with a mp4 video in it, the video plays on Macbooks and PCs, but it shows blank on iPad or iPod or iPhone. Although HTML5 as default mode, it doesn&#8217;t work. How to fix [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[25,5],"tags":[88,102,103,104,100,106,38,6],"class_list":["post-227","post","type-post","status-publish","format-standard","hentry","category-ios","category-wordpress","tag-html5","tag-ipad","tag-iphone","tag-ipod","tag-jw-player","tag-shortcodes","tag-video","tag-wordpress-2"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1pvi1-3F","jetpack-related-posts":[{"id":229,"url":"https:\/\/pixert.com\/blog\/php-conditional-statement-to-identify-ipad-or-ipod-or-iphone\/","url_meta":{"origin":227,"position":0},"title":"PHP Conditional statements to identify iPad or iPod or iPhone","author":"Pixel Insert \/ Pixert","date":"June 1, 2012","format":false,"excerpt":"This tutorial will show you how to detect iPad or iPod or iPhone using PHP Devices which request content from your website (usually) pass a user agent string. This contains information such as its name, OS, browser version, and rendering engine. Apple\u2019s gadgets pass the following user agents, although you\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2012\/05\/ipadiphoneipod.jpg?fit=649%2C540&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2012\/05\/ipadiphoneipod.jpg?fit=649%2C540&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2012\/05\/ipadiphoneipod.jpg?fit=649%2C540&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":268,"url":"https:\/\/pixert.com\/blog\/wordpress-limit-post\/","url_meta":{"origin":227,"position":1},"title":"WordPress Limit Post","author":"Pixel Insert \/ Pixert","date":"November 30, 2012","format":false,"excerpt":"This function controls the maximum\u00a0amount of characters displayed for an entry on the main page. If the set limit is surpassed, the text on the entry will be chopped\u00a0to that amount of characters, otherwise the content will be showed unchanged. Add following code to functions.php in your theme folder [php]\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":231,"url":"https:\/\/pixert.com\/blog\/wordpress-shortcode-in-custom-fields\/","url_meta":{"origin":227,"position":2},"title":"WordPress: Shortcode in Custom Field","author":"Pixel Insert \/ Pixert","date":"June 5, 2012","format":false,"excerpt":"Normally wordpress does not run shortcode that you put into a custom field. By default, Custom Fields display whatever value you enter, as plain-text, so if you try entering a shortcode, (in the format [shortcode] VALUE [\/shortcode]) you\u2019ll end up displaying the entire text, including the tags. Add the following\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":208,"url":"https:\/\/pixert.com\/blog\/how-to-add-a-wordpress-shortcode-outside-post-editor-php-template\/","url_meta":{"origin":227,"position":3},"title":"How to add a WordPress shortcode outside of the post editor or  PHP templates","author":"Pixel Insert \/ Pixert","date":"March 13, 2012","format":false,"excerpt":"Shortcodes were introduced back in WordPress 2.5. Shortcodes are for creating macros to be use in a posts. For instance, the following shortcode (in the post\/page content) would add a photo gallery into the page: [ \u00a0gallery \u00a0] If you want to use that shortcode outside of the WordPress post\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":217,"url":"https:\/\/pixert.com\/blog\/how-to-center-marker-pronamic-google-maps-plugin-wordpress\/","url_meta":{"origin":227,"position":4},"title":"How to center marker with Pronamic Google Maps plugin for WordPress","author":"Pixel Insert \/ Pixert","date":"March 26, 2012","format":false,"excerpt":"We have World map viewed as default map when Google Maps loaded in the website, now we want to make marker centered on the map. \u00a0Put the following JavaScript code snippet below Google Maps mashup code\u00a0 [php] jQuery(document).ready(function($) { \/\/ Mashup jQuery(\".pgmm\").bind(\"pronamic-google-maps-ready\", function(event, map){ map.setCenter(new google.maps.LatLng(latitude, longitude)); }); }); [\/php]\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":351,"url":"https:\/\/pixert.com\/blog\/wordpress-code-editor-enhancement\/","url_meta":{"origin":227,"position":5},"title":"WordPress Code Editor Enhancement","author":"Pixel Insert \/ Pixert","date":"June 8, 2014","format":false,"excerpt":"WordPress code editor (WP-Admin > Appearance > Editor) does not yet have a good editor with syntax highlighting, line numbers etc.\u00a0Following plugins expand WordPress Code Editor from plain code editor to more sophisticated code editor with a lot of great features. These plugins allows administrator to edit code without accessing\u2026","rel":"","context":"In &quot;WordPress&quot;","block_context":{"text":"WordPress","link":"https:\/\/pixert.com\/blog\/category\/wordpress\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/06\/wpeditor.jpg?fit=1051%2C907&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/06\/wpeditor.jpg?fit=1051%2C907&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/06\/wpeditor.jpg?fit=1051%2C907&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/06\/wpeditor.jpg?fit=1051%2C907&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2014\/06\/wpeditor.jpg?fit=1051%2C907&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/comments?post=227"}],"version-history":[{"count":0,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/227\/revisions"}],"wp:attachment":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media?parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/categories?post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/tags?post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}