I'm trying to embed x-vlc-plugin into my ember.js code.
HTML:
template: Ember.Handlebars.compile(
*/
* VLC Player Audio Tag
*/
'<embed type="application/x-vlc-plugin" '+
'id="audioX" '+
'autoplay="no" '+
'loop="no" '+
'volume="100" '+
'target="test.mp3">'
)
Controller:
player2: null,
playMusic: function()
{
this.set('player2', $('#audioX')[0]);
this.player2.playlist.play();
},
Error:
Uncaught TypeError: Cannot read property 'play' of undefined
Why, if simple HTML page (witohut ember.js ) works fine?
<html>
<head><title>test</title></head>
<body>
<embed type="application/x-vlc-plugin"
name="video1"
id="audioX"
autoplay="no" loop="yes" width="400" height="300"
target="test.mp3" />
<script>
var vlc = document.getElementById("audioX");
vlc.playlist.play();
</script>
</body>
</html>
In controllers, you must refer to properties using get
and set
:
this.player2.playlist.play();
should be:
this.get('player2').playlist.play();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.