Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

YouTube API
 
kevinjmcmahonjr
Jr. Member
 
Total Posts:  4
Joined:  2013-01-22
 

I have to post a YouTube video on a page in Magento, but it has to include Chapter markers on the page. The way I have found to do this utilizes the YouTube API, but Magento gives me an error when I add it.

Here is the sample I’m basing my chapter markers on to implement this feature.
https://developers.google.com/youtube/training/player/chapter-marker/

Since I have to add things to the head tag of the page, based on the information from that guide and from what I’ve learned so far with Magento, I have added the following to the Layout Update XML under the Design of the page

<reference name="header">
<action method="addJs"><script src="//www.youtube.com/player_api"></script></action>
<action method="addJs"><script>youtube/chapter_marker_player.js</script></action>
</reference>

As far as I understand, but putting that xml code into the Layout Update XML, it should put the script tags into the head tag.

When I view the page I get a “There has been an error procession your request” and then the following error

Invalid method Mage_Page_Block_Html_Header::addJs(Array
(
[0] => Mage_Core_Model_Layout_Element Object
(
[@attributes] => Array
(
[src] => //www.youtube.com/player_api
)

)

)
)

Trace:
#0 [internal function]: Varien_Object->__call(’addJs’, Array)
#1 /home/jbull/public_html/app/code/core/Mage/Core/Model/Layout.php(348): Mage_Page_Block_Html_Header->addJs(Object(Mage_Core_Model_Layout_Element))
#2 /home/jbull/public_html/app/code/core/Mage/Core/Model/Layout.php(214): Mage_Core_Model_Layout->_generateAction(Array, Array)
#3 /home/jbull/public_html/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#4 /home/jbull/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#5 /home/jbull/public_html/app/code/core/Mage/Cms/Helper/Page.php(113): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#6 /home/jbull/public_html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage()
#7 /home/jbull/public_html/app/code/core/Mage/Cms/controllers/PageController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_PageController), ‘17’)
#8 /home/jbull/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Cms_PageController->viewAction(Object(Mage_Cms_PageController), ‘17’)
#9 /home/jbull/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch()
#10 /home/jbull/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(’view’)
#11 /home/jbull/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch(Object(Mage_Core_Controller_Request_Http))
#12 /home/jbull/public_html/app/Mage.php(683): Mage_Core_Model_App->run()
#13 /home/jbull/public_html/index.php(87): Mage::run(Array)
#14 {main}

I have tried tweaking the xml code above a few different ways, but each time I get a similar error message

Anyone have any ideas on how I can get the YouTube Player API to load in Magento?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top