473,287 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

How can I capture youtube player state changes with the youtube_player_iframe library?

Using the youtube_player_iframe library I was able to capture some video status data (playing, paused, with/without audio) for xAPI statemetns, but from external buttons, not from the player itself.

Video player
Expand|Select|Wrap|Line Numbers
  1.   Widget oneVideo(BuildContext context, double heigth, double width) {
  2.     return SingleChildScrollView(
  3.         child: Column(
  4.       children: [
  5.         SizedBox(
  6.           height: heigth,
  7.           width: width,
  8.           child: YoutubePlayer(
  9.             controller: _controller,
  10.             backgroundColor: Colors.black,
  11.           ),
  12.         ),
  13.       ],
  14.     ));
  15.   }
  16.  
My custom buttons
Expand|Select|Wrap|Line Numbers
  1. Row optionButtons(BuildContext context) {
  2.     return Row(
  3.       children: [
  4.         YoutubeValueBuilder(
  5.           builder: (context, value) {
  6.             return IconButton(
  7.               icon: Icon(
  8.                 value.playerState == PlayerState.playing
  9.                     ? Icons.pause
  10.                     : Icons.play_arrow,
  11.               ),
  12.               onPressed: () {
  13.                 if (value.playerState == PlayerState.playing) {
  14.                   context.ytController.pauseVideo();
  15.                   pausePlay(
  16.                       "Pause", "WatchTemplateVideo", context.ytController);
  17.                 } else {
  18.                   context.ytController.playVideo();
  19.                   pausePlay("Play", "WatchTemplateVideo", context.ytController);
  20.                 }
  21.               },
  22.             );
  23.           },
  24.         )
  25.       ],
  26.     );
  27.   }
  28.  
The clasws builder
Expand|Select|Wrap|Line Numbers
  1. Widget build(BuildContext context) {
  2.     double heigth = MediaQuery.of(context).size.height * 0.7;
  3.     double width = MediaQuery.of(context).size.width * 0.7;
  4.     return YoutubePlayerScaffold(
  5.         controller: _controller,
  6.         builder: (context, player) {
  7.           return YoutubePlayerControllerProvider(
  8.             controller: _controller,
  9.             child: Column(
  10.               children: [
  11.                 oneVideo(context, heigth, width),
  12.                 optionButtons(context)
  13.               ],
  14.             ),
  15.           );
  16.         });
  17.   }
  18.  
However I have not been able to get it to capture the data from the internal controls of the player. I would be very grateful for your help :" )
Jan 20 '23 #1
0 4936

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Paolo Losi | last post by:
Hi all, I'm pretty new to the python language so please excuse me if this is FAQ... I'm very glad to be part of the list! :-) I'm looking into a way to implement a generic workflow framework...
0
by: Dave | last post by:
Hello all, I have recently completed work on a generic implementation of a state space search library (standard C++ only). I have also written a toy client application - the classic 8 puzzle -...
4
by: DoomedLung | last post by:
I have been developing an image gallery which needed to be dynamic as possible. so I have placed the gallery in a div plus a div containing the large image to be displayed. It works by changing...
3
by: DoomedLung | last post by:
I have been developing an image gallery which needed to be dynamic as possible. so I have placed the gallery in a div plus a div containing the large image to be displayed. It works by changing...
0
by: Yama | last post by:
Hi, I am trying to create a solution that will keep track of the changes occurring in: BeginInvoke, Invoke, and EndEnvoke of a delegate/event I could associate then to it a OnChangingState...
2
by: Greg | last post by:
I am building an SVG interface (with Javascript) for client side control of some hardware. The svg will be hosted on a micro PC (http://www.picotux.com/indexe.html). It runs a uClinux OS with GCC...
1
by: sri2097 | last post by:
Basically, I want to check if a URL is playable or not (without actually playing it). i.e. given a URL I want to write an automation script to figure it out for me if it's playable or not. If...
13
by: Jim Langston | last post by:
I had asked this in comp.lang.c++ with out any answers that would actually work, so I'm hoping someone here may know a way. I am calling C library functions that want to output to stdout. I need...
4
by: laktofil | last post by:
This may seem like an abstract question on behavioral inheritance. Anyway, I'm building a hierarchical state machine in C++ (with gcc for target platform Gentoo Linux). More precisely, I'm using this...
1
by: smartic | last post by:
I have two problems with YouTube embedded code: <object id="selected-box_11027" width="460" height="330"...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.