Giter Site home page Giter Site logo

Comments (6)

samarthagarwal avatar samarthagarwal commented on June 11, 2024 2

I created a new class called CastMediaPlus. I read the official Google docs and implemented several new features. Here is an implementation of the class.

import 'package:dart_chromecast/casting/cast_media.dart';

class CastMediaPlus extends CastMedia {
  final String contentId;
  String title;
  String subtitle;
  String artist;
  String composer;
  bool autoPlay = true;
  double position;
  String contentType;
  List<String> images;

  CastMediaPlus({
    this.contentId,
    this.title,
    this.subtitle,
    this.artist,
    this.composer,
    this.autoPlay = true,
    this.position = 0.0,
    this.contentType = 'video/mp4',
    this.images,
  }) {
    if (null == images) {
      images = [];
    }
  }

  Map toChromeCastMap() {
    return {
      'type': 'LOAD',
      'autoPlay': autoPlay,
      'currentTime': position,
      'activeTracks': [],
      'media': {
        'contentId': contentId,
        'contentType': contentType,
        'images': images.map((image) {
          return {
            'url': image,
          };
        }).toList(),
        'title': title,
        'streamType': 'BUFFERED',
        'metadata': {
          'metadataType': 3,
          'title': title,
          'albumName': subtitle,
          'artist': artist,
          'composer': composer,
          'images': images.map((image) {
            return {
              'url': image,
            };
          }).toList(),
        }
      }
    };
  }
}

Now, you can use CastMediaPlus in place of CastMedia.

CastMediaPlus cmp = CastMediaPlus(
            title: "My title",
            subtitle: "My subtitle",
            artist: "Artist's name",
            composer: "Composer's name",
            contentId: "URL to the audio file",
            images: ["URL to the cover image"],
            contentType: 'audio/mp4',
);

Hope it helps. I wanted to release my own version of the plugin but I am kind of too busy to do it right now.

from flutter_chromecast_example.

samarthagarwal avatar samarthagarwal commented on June 11, 2024 1

Found the workaround.

from flutter_chromecast_example.

letiagoalves avatar letiagoalves commented on June 11, 2024

@samarthagarwal Hi, I am having the same problem, how were you able to you get around this issue?

from flutter_chromecast_example.

subhash279 avatar subhash279 commented on June 11, 2024

You are a life saver :)

from flutter_chromecast_example.

subhash279 avatar subhash279 commented on June 11, 2024

@samarthagarwal thanks for the details on showing images. Can you pls point me to the documentation you used. I am trying to change playback speed on the cast audio. Not sure where to start or if it's even possible. Do you have any idea about this?

from flutter_chromecast_example.

terrabythia avatar terrabythia commented on June 11, 2024

Hope it helps. I wanted to release my own version of the plugin but I am kind of too busy to do it right now.

Would be way more helpful if you'd create a pull request for this repo instead of creating yet another version of this plugin. Since you already have everything working that shouldn't be that much work.

from flutter_chromecast_example.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.