Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change timeout time? #31

Closed
Cosminnv opened this issue Jun 17, 2022 · 3 comments
Closed

How to change timeout time? #31

Cosminnv opened this issue Jun 17, 2022 · 3 comments

Comments

@Cosminnv
Copy link

I have a list of videos that all start loading at the same time and some of them go in timeout before they finish loading. Is there any way to set after how long the initialisation should go in timeout, or any way to check if a video initialisation went in timeout and redo it?

I'm currently using pod_player version 0.0.6 and this problem seems to only be happening on iOS.

This is the error that AVPlayer is returning:
Unhandled Exception: PlatformException(VideoError, Failed to load video: Tempo di richiesta scaduto (translated in english: request timeout) , null, null).

I'm playing a video from vimeoID.

@newtaDev
Copy link
Owner

Thanks for filing the issue. Can you please share the steps to reproduce the issue.

@Cosminnv
Copy link
Author

Download the example app and do these changes:

from_vimeo_id.dart

import 'package:flutter/material.dart';

class PlayVideoFromVimeoId extends StatefulWidget {
  const PlayVideoFromVimeoId({Key? key}) : super(key: key);

  @override
  State<PlayVideoFromVimeoId> createState() => _PlayVideoFromVimeoIdState();
}

class _PlayVideoFromVimeoIdState extends State<PlayVideoFromVimeoId> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Vimeo Player')),
      body: SafeArea(
        child: Center(
          child: ListView.separated(
            itemCount: 25,
            separatorBuilder: (ctx, index) {
              return const SizedBox(
                height: 10,
              );
            },
            itemBuilder: (ctx, index) {
              return const VideoItem();
            },
            shrinkWrap: true,
          ),
        ),
      ),
    );
  }
}

video_item.dart

import 'package:flutter/material.dart';
import 'package:pod_player/pod_player.dart';

class VideoItem extends StatefulWidget {
  const VideoItem({Key? key}) : super(key: key);

  @override
  State<VideoItem> createState() => _VideoItemState();
}

class _VideoItemState extends State<VideoItem>
    with AutomaticKeepAliveClientMixin {
  late final PodPlayerController controller;

  @override
  bool get wantKeepAlive => true;


  @override
  void dispose() {
    super.dispose();
    controller.dispose();
  }

  @override
  void initState() {
    controller = PodPlayerController(
      podPlayerConfig: const PodPlayerConfig(wakelockEnabled: true,autoPlay: false),
      playVideoFrom: PlayVideoFrom.vimeo('306495342'),
    )..initialise();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return PodVideoPlayer(
      controller: controller,
      alwaysShowProgressBar: false,
    );
  }
}

This only happens on iOS

@newtaDev
Copy link
Owner

To play list of videos please refer this example
https://github.com/newtaDev/pod_player/blob/master/example/lib/examples/play_list_of_videos.dart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants