Suganthan Raj
Suganthan Raj

Reputation: 2424

How to customize event listener in ActionScript 3.0 YouTube flash player api

Here is my code:

var player;

    function onYouTubeIframeAPIReady() {
        player = new YT.Player('myytflashplayer', {
            loadPlaylist:{


            },
            events: {
                'onReady': onPlayerReady,
                'onPlayerStateChange': onPlayerStateChange
            }
        });

    }

    function onPlayerReady(event) {
        event.target.mute();
        event.target.playVideo(10);
        event.target.seekTo(10);
        event.target.playVideoAt(5);


    }
    var done = false;

    function onPlayerStateChange() {
        if (event.data == YT.Player.PLAYING && !done) {
            event.setTimeout(stopVideo,6000);
            done=true;

        }
    }

    function seekTo() {

        player.seekTo();
    }

    public

    function playVideo() {
        player.playVideo()
    }

    public

    function pauseVideo() {
        player.pauseVideo()
    }

    public

    function stopVideo() {
        player.stopVideo()
    }

    public

    function muteVideo() {
        player.mute()
    }

    public

    function unmuteVideo() {
            player.unMute()
        }
        //   var params = { allowScriptAccess: "always" };
        //       var atts = { id: "myytplayer" };
        //       swfobject.embedSWF("http://www.youtube.com/v/Kunq0JnYCKE?version=3&origin=https://developers.google.com&enablejsapi=1&loop=1&autoplay=1&start=10&rel=0","ytapiplayer", "800", "500", "8", null, null, params, atts);
        // });
</script>

<object width="640" height="390" >
    <param name="movie" value="https://www.youtube.com/v/videoseries?version=3&listType=playlist&list=PLqRSwyqnU1WEECXxN3uN08G24h34EQOko&autoplay=1"></param>
    <param name="allowScriptAccess" value="always"></param>
    <embed src="https://www.youtube.com/v/videoseries?version=3&listType=playlist&list=PLqRSwyqnU1WEECXxN3uN08G24h34EQOko&origin=https://developers.google.com&enablejsapi=1&playerapiid=myytflashplayer&autoplay=1" type="application/x-shockwave-flash"
    allowscriptaccess="always" width="640" height="390"></embed>
</object>

here is my event to do in my flash action script 3.0 youtube player api

Upvotes: 0

Views: 166

Answers (1)

Tim Wintle
Tim Wintle

Reputation: 2433

I think you are a bit confused with which API you are using. The YT.Player api uses the HTML5 iframe player API, but you are inserting a flash object at the bottom - which is a different API.

Documentation for the iframe player is here: https://developers.google.com/youtube/iframe_api_reference

And Documentation for the Javascript interface to the Flash players is available here: https://developers.google.com/youtube/js_api_reference

Upvotes: 0

Related Questions