-
Notifications
You must be signed in to change notification settings - Fork 1
/
Note.txt
73 lines (54 loc) · 2.47 KB
/
Note.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*****JAVA - UJJWAL*****/
youTubePlayerView.addYouTubePlayerListener(new AbstractYouTubePlayerListener() {
@Override
public void onReady(@NonNull final YouTubePlayer youTubePlayer) {
String videoId = "E4ZJxhyAaH8";
youTubePlayer.cueVideo(videoId, 0);
//youTubePlayer.loadVideo(videoId, 0);
findViewById(R.id.play).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
youTubePlayer.play();
}
});
findViewById(R.id.pause).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
youTubePlayer.pause();
}
});
}
});
/*****KOTLIN - SUBRATA*****/
holder.youtube_player_view.getYouTubePlayerWhenReady(object : YouTubePlayerCallback {
override fun onYouTubePlayer(youTubePlayer: YouTubePlayer) {
youTubePlayer.loadVideo(itemdata.getString("response").toString(), itemdata.get("ans_start").toString().toFloat())
//youTubePlayer.pause()
holder.youtube_player_view.setTag(itemdata.get("ans_end").toString().toFloat())
youTubePlayer.addListener(object : YouTubePlayerListener {
override fun onApiChange(youTubePlayer: YouTubePlayer) {
}
override fun onCurrentSecond(youTubePlayer: YouTubePlayer, second: Float) {
if (holder.youtube_player_view.getTag().toString().toFloat() <= second) {
youTubePlayer.pause()
}
}
override fun onError(youTubePlayer: YouTubePlayer, error: PlayerConstants.PlayerError) {
}
override fun onPlaybackQualityChange(youTubePlayer: YouTubePlayer, playbackQuality: PlayerConstants.PlaybackQuality) {
}
override fun onPlaybackRateChange(youTubePlayer: YouTubePlayer, playbackRate: PlayerConstants.PlaybackRate) {
}
override fun onReady(youTubePlayer: YouTubePlayer) {
}
override fun onStateChange(youTubePlayer: YouTubePlayer, state: PlayerConstants.PlayerState) {
}
override fun onVideoDuration(youTubePlayer: YouTubePlayer, duration: Float) {
}
override fun onVideoId(youTubePlayer: YouTubePlayer, videoId: String) {
}
override fun onVideoLoadedFraction(youTubePlayer: YouTubePlayer, loadedFraction: Float) {
}
})
}
})