Showing
5 changed files
with
17 additions
and
5 deletions
| ... | @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; | ... | @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; |
| 6 | import 'package:getwidget/getwidget.dart'; | 6 | import 'package:getwidget/getwidget.dart'; |
| 7 | import 'package:path_provider/path_provider.dart'; | 7 | import 'package:path_provider/path_provider.dart'; |
| 8 | import 'package:share_plus/share_plus.dart'; | 8 | import 'package:share_plus/share_plus.dart'; |
| 9 | +import '../../events/trans_event.dart'; | ||
| 9 | import '../../net/dio_utils.dart'; | 10 | import '../../net/dio_utils.dart'; |
| 10 | import '../../net/http_api.dart'; | 11 | import '../../net/http_api.dart'; |
| 11 | import '../theme/tik_video_player.dart'; | 12 | import '../theme/tik_video_player.dart'; |
| ... | @@ -41,10 +42,10 @@ class VideoSlidesState extends State<VideoSlides> { | ... | @@ -41,10 +42,10 @@ class VideoSlidesState extends State<VideoSlides> { |
| 41 | super.initState(); | 42 | super.initState(); |
| 42 | isPraise = widget.isPraise; | 43 | isPraise = widget.isPraise; |
| 43 | isCollect = widget.isCollect; | 44 | isCollect = widget.isCollect; |
| 44 | - recodeVideoPlayStatus(); | 45 | + recordVideoPlayStatus(); |
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | - Future<void> recodeVideoPlayStatus() async { | 48 | + Future<void> recordVideoPlayStatus() async { |
| 48 | String url = '${HttpApi.addView}/${widget.videoId}'; | 49 | String url = '${HttpApi.addView}/${widget.videoId}'; |
| 49 | // 统计观看数 | 50 | // 统计观看数 |
| 50 | DioUtils.instance.asyncRequestNetwork( | 51 | DioUtils.instance.asyncRequestNetwork( |
| ... | @@ -278,6 +279,7 @@ class VideoSlidesState extends State<VideoSlides> { | ... | @@ -278,6 +279,7 @@ class VideoSlidesState extends State<VideoSlides> { |
| 278 | icon: const Icon(Icons.video_call_outlined), | 279 | icon: const Icon(Icons.video_call_outlined), |
| 279 | buttonColor: Colors.teal, | 280 | buttonColor: Colors.teal, |
| 280 | onPress: () { | 281 | onPress: () { |
| 282 | + eventBus.fire(TransEvent()); | ||
| 281 | String url = | 283 | String url = |
| 282 | '${PoemRouter.poemRecordVideoPage}?id=${widget.videoId}&type=${widget.poemType}'; | 284 | '${PoemRouter.poemRecordVideoPage}?id=${widget.videoId}&type=${widget.poemType}'; |
| 283 | NavigatorUtils.push( | 285 | NavigatorUtils.push( |
| ... | @@ -289,6 +291,7 @@ class VideoSlidesState extends State<VideoSlides> { | ... | @@ -289,6 +291,7 @@ class VideoSlidesState extends State<VideoSlides> { |
| 289 | icon: const Icon(Icons.mic_none_outlined), | 291 | icon: const Icon(Icons.mic_none_outlined), |
| 290 | buttonColor: Colors.green, | 292 | buttonColor: Colors.green, |
| 291 | onPress: () { | 293 | onPress: () { |
| 294 | + eventBus.fire(TransEvent()); | ||
| 292 | NavigatorUtils.push( | 295 | NavigatorUtils.push( |
| 293 | context, | 296 | context, |
| 294 | '${PoemRouter.poemRecordAudioPage}?id=${widget.videoId}&type=${widget.poemType}', | 297 | '${PoemRouter.poemRecordAudioPage}?id=${widget.videoId}&type=${widget.poemType}', | ... | ... |
| ... | @@ -73,7 +73,7 @@ class _PoemCompletePageState extends State<PoemCompletePage> { | ... | @@ -73,7 +73,7 @@ class _PoemCompletePageState extends State<PoemCompletePage> { |
| 73 | onPressed: () { | 73 | onPressed: () { |
| 74 | NavigatorUtils.push( | 74 | NavigatorUtils.push( |
| 75 | context, | 75 | context, |
| 76 | - Routes.home, | 76 | + Routes.navBarPage, |
| 77 | clearStack: true, | 77 | clearStack: true, |
| 78 | ); | 78 | ); |
| 79 | }, | 79 | }, | ... | ... |
| ... | @@ -164,7 +164,7 @@ class AudioToolBar extends StatefulWidget { | ... | @@ -164,7 +164,7 @@ class AudioToolBar extends StatefulWidget { |
| 164 | class _AudioToolBarState extends State<AudioToolBar> { | 164 | class _AudioToolBarState extends State<AudioToolBar> { |
| 165 | late final PausableTimer _timer; | 165 | late final PausableTimer _timer; |
| 166 | int currentTimer = 0; | 166 | int currentTimer = 0; |
| 167 | - int duration = 10 * 1000; //TODO 60 * 1000; | 167 | + int duration = 60 * 1000; |
| 168 | 168 | ||
| 169 | Codec _codec = Codec.aacMP4; //TODO why accMP4? | 169 | Codec _codec = Codec.aacMP4; //TODO why accMP4? |
| 170 | String _mPath = 'tau_file.mp4'; | 170 | String _mPath = 'tau_file.mp4'; | ... | ... |
| ... | @@ -51,7 +51,7 @@ class PoemRecordVideoPageState extends State<PoemRecordVideoPage> | ... | @@ -51,7 +51,7 @@ class PoemRecordVideoPageState extends State<PoemRecordVideoPage> |
| 51 | 51 | ||
| 52 | late final PausableTimer _timer; | 52 | late final PausableTimer _timer; |
| 53 | int currentTimer = 0; | 53 | int currentTimer = 0; |
| 54 | - int duration = 10 * 1000; //TODO 60 * 1000; | 54 | + int duration = 60 * 1000; |
| 55 | 55 | ||
| 56 | @override | 56 | @override |
| 57 | void initState() { | 57 | void initState() { | ... | ... |
| 1 | +import 'dart:async'; | ||
| 2 | + | ||
| 3 | +import 'package:Parlando/events/trans_event.dart'; | ||
| 1 | import 'package:chewie/chewie.dart'; | 4 | import 'package:chewie/chewie.dart'; |
| 2 | import 'package:flutter/material.dart'; | 5 | import 'package:flutter/material.dart'; |
| 3 | import 'package:flutter/services.dart'; | 6 | import 'package:flutter/services.dart'; |
| ... | @@ -43,17 +46,23 @@ class TikVideoPlayer extends StatefulWidget { | ... | @@ -43,17 +46,23 @@ class TikVideoPlayer extends StatefulWidget { |
| 43 | class _TikVideoPlayerState extends State<TikVideoPlayer> { | 46 | class _TikVideoPlayerState extends State<TikVideoPlayer> { |
| 44 | late VideoPlayerController _videoPlayerController; | 47 | late VideoPlayerController _videoPlayerController; |
| 45 | ChewieController? _chewieController; | 48 | ChewieController? _chewieController; |
| 49 | + late StreamSubscription bus; | ||
| 46 | 50 | ||
| 47 | @override | 51 | @override |
| 48 | void initState() { | 52 | void initState() { |
| 49 | initializePlayer(); | 53 | initializePlayer(); |
| 50 | super.initState(); | 54 | super.initState(); |
| 55 | + | ||
| 56 | + bus = eventBus.on<TransEvent>().listen((event) { | ||
| 57 | + _chewieController!.videoPlayerController.pause(); | ||
| 58 | + }); | ||
| 51 | } | 59 | } |
| 52 | 60 | ||
| 53 | @override | 61 | @override |
| 54 | void dispose() { | 62 | void dispose() { |
| 55 | _videoPlayerController.dispose(); | 63 | _videoPlayerController.dispose(); |
| 56 | _chewieController!.dispose(); | 64 | _chewieController!.dispose(); |
| 65 | + bus.cancel(); | ||
| 57 | super.dispose(); | 66 | super.dispose(); |
| 58 | } | 67 | } |
| 59 | 68 | ... | ... |
-
Please register or login to post a comment